diff --git a/theme.cpp b/theme.cpp index a6b5b43e2..e550d2afb 100644 --- a/theme.cpp +++ b/theme.cpp @@ -36,6 +36,7 @@ class Theme::Private public: Private() { + generalFont = QApplication::font(); } KConfigGroup config() @@ -52,6 +53,7 @@ public: QString themeName; QString app; KSharedConfigPtr colors; + QFont generalFont; }; class ThemeSingleton @@ -165,16 +167,21 @@ QColor Theme::textColor() const return colors.foreground(KColorScheme::NormalText).color(); } +void Theme::setFont(const QFont &font) +{ + d->generalFont = font; +} + QFont Theme::font() const { //TODO: allow this to be overridden with a plasma specific font? - return QApplication::font(); + return d->generalFont; } QFontMetrics Theme::fontMetrics() const { //TODO: allow this to be overridden with a plasma specific font? - return QApplication::fontMetrics(); + return QFontMetrics(d->generalFont); } } diff --git a/theme.h b/theme.h index 8621a9a5e..c108ab86d 100644 --- a/theme.h +++ b/theme.h @@ -103,6 +103,12 @@ class PLASMA_EXPORT Theme : public QObject */ Q_INVOKABLE QColor textColor() const; + /** + * Sets the default font to be used with themed items. Defaults to + * the application wide default font. + */ + Q_INVOKABLE void setFont(const QFont &font); + /** * Returns the font to be used by themed items */