diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -139,12 +139,17 @@ Property { name: "focusColor"; type: "QColor" } Property { name: "hoverColor"; type: "QColor" } Property { name: "defaultFont"; type: "QFont"; isReadonly: true } + Property { name: "smallestFont"; type: "QFont"; isReadonly: true } Property { name: "palette"; type: "QPalette"; isReadonly: true } Signal { name: "colorsChanged" } Signal { name: "defaultFontChanged" Parameter { name: "font"; type: "QFont" } } + Signal { + name: "smallestFontChanged" + Parameter { name: "font"; type: "QFont" } + } Signal { name: "colorSetChanged" Parameter { name: "colorSet"; type: "Kirigami::PlatformTheme::ColorSet" } @@ -1856,6 +1861,7 @@ Property { name: "complementaryHoverColor"; type: "QColor" } Property { name: "complementaryFocusColor"; type: "QColor" } Property { name: "defaultFont"; type: "QFont" } + Property { name: "smallestFont"; type: "QFont" } Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } Method { name: "__propagateColorSet" diff --git a/src/libkirigami/platformtheme.h b/src/libkirigami/platformtheme.h --- a/src/libkirigami/platformtheme.h +++ b/src/libkirigami/platformtheme.h @@ -168,6 +168,7 @@ // font and palette Q_PROPERTY(QFont defaultFont READ defaultFont NOTIFY defaultFontChanged) + Q_PROPERTY(QFont smallestFont READ smallestFont NOTIFY smallestFontChanged) //Active palette Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged) @@ -230,6 +231,7 @@ QColor hoverColor() const; QFont defaultFont() const; + QFont smallestFont() const; //this may is used by the desktop QQC2 to set the styleoption palettes QPalette palette() const; @@ -270,6 +272,7 @@ //TODO: parameters to signals as this is also a c++ api void colorsChanged(); void defaultFontChanged(const QFont &font); + void smallestFontChanged(const QFont &font); void colorSetChanged(Kirigami::PlatformTheme::ColorSet colorSet); void colorGroupChanged(Kirigami::PlatformTheme::ColorGroup colorGroup); void paletteChanged(const QPalette &pal); diff --git a/src/libkirigami/platformtheme.cpp b/src/libkirigami/platformtheme.cpp --- a/src/libkirigami/platformtheme.cpp +++ b/src/libkirigami/platformtheme.cpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace Kirigami { @@ -608,8 +609,13 @@ d->font = font; emit defaultFontChanged(font); + emit smallestFontChanged(smallestFont()); } +QFont PlatformTheme::smallestFont() const +{ + return QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont); +} #define PROPAGATECUSTOMCOLOR(colorName, color)\ for (PlatformTheme *t : qAsConst(d->m_childThemes)) {\