From 6df4a21e8a031b04a41fa060f0fe354d814cdc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Sat, 5 Oct 2013 06:18:50 +0200 Subject: [PATCH] Port declarative theme away from KGlobalSettings` --- src/declarativeimports/core/theme.cpp | 14 ++++++++++++-- src/declarativeimports/core/theme.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/declarativeimports/core/theme.cpp b/src/declarativeimports/core/theme.cpp index 1b91a4cca..91256bee4 100644 --- a/src/declarativeimports/core/theme.cpp +++ b/src/declarativeimports/core/theme.cpp @@ -46,14 +46,24 @@ ThemeProxy::ThemeProxy(QQmlEngine *parent) connect(this, &Plasma::Theme::themeChanged, this, &ThemeProxy::themeChanged); connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged())); - //connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeProxy::defaultFontChanged); - //connect(KGlobalSettings::self(), &KGlobalSettings::kdisplayFontChanged, this, &ThemeProxy::smallestFontChanged); + installEventFilter(qApp); } ThemeProxy::~ThemeProxy() { } +bool ThemeProxy::eventFilter(QObject *watched, QEvent *event) +{ + if (watched == QCoreApplication::instance()) { + if (event->type() == QEvent::ApplicationFontChange || event->type() == QEvent::FontChange) { + defaultFontChanged(); + smallestFontChanged(); + } + } + return QObject::eventFilter(watched, event); +} + QString ThemeProxy::themeName() const { return Plasma::Theme::themeName(); diff --git a/src/declarativeimports/core/theme.h b/src/declarativeimports/core/theme.h index c83348404..5936be7a4 100644 --- a/src/declarativeimports/core/theme.h +++ b/src/declarativeimports/core/theme.h @@ -136,6 +136,7 @@ Q_SIGNALS: void smallestFontChanged(); private: + bool eventFilter(QObject *watched, QEvent *event); int m_defaultIconSize; QQmlPropertyMap *m_iconSizes; QQmlEngine *m_engine;