font accessors for the theme

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=750643
This commit is contained in:
Aaron J. Seigo 2007-12-19 19:56:39 +00:00
parent 378abc9a38
commit 34bd2b87b2
2 changed files with 25 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "theme.h"
#include <QApplication>
#include <QFile>
#include <KColorScheme>
@ -164,6 +165,18 @@ QColor Theme::textColor() const
return colors.foreground(KColorScheme::NormalText).color();
}
QFont Theme::font() const
{
//TODO: allow this to be overridden with a plasma specific font?
return QApplication::font();
}
QFontMetrics Theme::fontMetrics() const
{
//TODO: allow this to be overridden with a plasma specific font?
return QApplication::fontMetrics();
}
}
#include <theme.moc>

12
theme.h
View File

@ -21,6 +21,8 @@
#define PLASMA_THEME_H
#include <QtCore/QObject>
#include <QtGui/QFont>
#include <QtGui/QFontMetrics>
#include <KDE/KSharedConfig>
@ -101,6 +103,16 @@ class PLASMA_EXPORT Theme : public QObject
*/
Q_INVOKABLE QColor textColor() const;
/**
* Returns the font to be used by themed items
*/
Q_INVOKABLE QFont font() const;
/**
* Returns the font metrics for the font to be used by themed items
*/
Q_INVOKABLE QFontMetrics fontMetrics() const;
Q_SIGNALS:
/**
* Emitted when the user changes the theme. SVGs should be reloaded at