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:
parent
0946029d25
commit
7be6e23d58
11
theme.cpp
11
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
6
theme.h
6
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user