From 7a30024fa1fe4e09902f2fd7fc9022b427376dd4 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 29 Jul 2009 23:50:05 +0200 Subject: [PATCH] Don't reset FontSelector font on style change Qt resets the font of all widgets if the application stylesheet is set. Thus, we intercept the ChangeEvent and restore the custom font for FontSelector. --- src/uisupport/fontselector.cpp | 10 +++++++++- src/uisupport/fontselector.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/uisupport/fontselector.cpp b/src/uisupport/fontselector.cpp index 6330693e..8a53551b 100644 --- a/src/uisupport/fontselector.cpp +++ b/src/uisupport/fontselector.cpp @@ -18,8 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include +#include #include +#include #include #include @@ -68,3 +69,10 @@ void FontSelector::chooseFont() { } } +void FontSelector::changeEvent(QEvent *e) { + if(e->type() == QEvent::StyleChange) { + _demo->setFont(_font); + } +} + + diff --git a/src/uisupport/fontselector.h b/src/uisupport/fontselector.h index d7ca9e18..60d27776 100644 --- a/src/uisupport/fontselector.h +++ b/src/uisupport/fontselector.h @@ -43,6 +43,9 @@ public slots: signals: void fontChanged(const QFont &); +protected: + void changeEvent(QEvent *e); + protected slots: void chooseFont(); -- 2.20.1