diff --git a/src/declarativeimports/core/theme.cpp b/src/declarativeimports/core/theme.cpp index 552b83b7e..d72997945 100644 --- a/src/declarativeimports/core/theme.cpp +++ b/src/declarativeimports/core/theme.cpp @@ -59,26 +59,14 @@ QString ThemeProxy::themeName() const return Plasma::Theme::themeName(); } -QJSValue ThemeProxy::defaultFont() const +QFont ThemeProxy::defaultFont() const { - QJSValue val(m_engine->toScriptValue(QApplication::font())); - const QSize size(QFontMetrics(QApplication::font()).boundingRect("M").size()); - QJSValue sizeObj(m_engine->newObject()); - sizeObj.setProperty("width", size.width()); - sizeObj.setProperty("height", size.height()); - val.setProperty("mSize", sizeObj); - return val; + return QApplication::font(); } -QJSValue ThemeProxy::smallestFont() const +QFont ThemeProxy::smallestFont() const { - QJSValue val(m_engine->toScriptValue(KGlobalSettings::smallestReadableFont())); - const QSize size(QFontMetrics(QApplication::font()).boundingRect("M").size()); - QJSValue sizeObj(m_engine->newObject()); - sizeObj.setProperty("width", size.width()); - sizeObj.setProperty("height", size.height()); - val.setProperty("mSize", sizeObj); - return val; + return KGlobalSettings::smallestReadableFont(); } QSizeF ThemeProxy::mSize(const QFont &font) const diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index 81d091d09..c83348404 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -45,8 +45,8 @@ class ThemeProxy : public Plasma::Theme Q_PROPERTY(QString wallpaperPath READ wallpaperPath NOTIFY themeChanged) //fonts - Q_PROPERTY(QJSValue defaultFont READ defaultFont NOTIFY defaultFontChanged) - Q_PROPERTY(QJSValue smallestFont READ smallestFont NOTIFY smallestFontChanged) + Q_PROPERTY(QFont defaultFont READ defaultFont NOTIFY defaultFontChanged) + Q_PROPERTY(QFont smallestFont READ smallestFont NOTIFY smallestFontChanged) // colors Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChanged) @@ -90,8 +90,8 @@ public: ~ThemeProxy(); QString themeName() const; - QJSValue defaultFont() const; - QJSValue smallestFont() const; + QFont defaultFont() const; + QFont smallestFont() const; /** * @return The size of an uppercase M in a font, defaultFont() by default */ diff --git a/src/declarativeimports/plasmacomponents/qml/Label.qml b/src/declarativeimports/plasmacomponents/qml/Label.qml index 51b8ea120..93d328fdd 100644 --- a/src/declarativeimports/plasmacomponents/qml/Label.qml +++ b/src/declarativeimports/plasmacomponents/qml/Label.qml @@ -48,4 +48,9 @@ Text { color: theme.textColor opacity: enabled? 1 : 0.6 + Component.onCompleted: { + for (var i in theme.defaultFont) { + print("AA"+i+theme.defaultFont[i]) + } + } }