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:
|
public:
|
||||||
Private()
|
Private()
|
||||||
{
|
{
|
||||||
|
generalFont = QApplication::font();
|
||||||
}
|
}
|
||||||
|
|
||||||
KConfigGroup config()
|
KConfigGroup config()
|
||||||
@ -52,6 +53,7 @@ public:
|
|||||||
QString themeName;
|
QString themeName;
|
||||||
QString app;
|
QString app;
|
||||||
KSharedConfigPtr colors;
|
KSharedConfigPtr colors;
|
||||||
|
QFont generalFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThemeSingleton
|
class ThemeSingleton
|
||||||
@ -165,16 +167,21 @@ QColor Theme::textColor() const
|
|||||||
return colors.foreground(KColorScheme::NormalText).color();
|
return colors.foreground(KColorScheme::NormalText).color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Theme::setFont(const QFont &font)
|
||||||
|
{
|
||||||
|
d->generalFont = font;
|
||||||
|
}
|
||||||
|
|
||||||
QFont Theme::font() const
|
QFont Theme::font() const
|
||||||
{
|
{
|
||||||
//TODO: allow this to be overridden with a plasma specific font?
|
//TODO: allow this to be overridden with a plasma specific font?
|
||||||
return QApplication::font();
|
return d->generalFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontMetrics Theme::fontMetrics() const
|
QFontMetrics Theme::fontMetrics() const
|
||||||
{
|
{
|
||||||
//TODO: allow this to be overridden with a plasma specific font?
|
//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;
|
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
|
* Returns the font to be used by themed items
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user