add ability to set the general font to something else at runtime

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=751049
This commit is contained in:
Aaron J. Seigo 2007-12-20 23:44:08 +00:00
parent 0946029d25
commit 7be6e23d58
2 changed files with 15 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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
*/