Don't reset FontSelector font on style change
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 29 Jul 2009 21:50:05 +0000 (23:50 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Aug 2009 18:25:06 +0000 (20:25 +0200)
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
src/uisupport/fontselector.h

index 6330693..8a53551 100644 (file)
@@ -18,8 +18,9 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
-#include <QHBoxLayout>
+#include <QEvent>
 #include <QFontDialog>
+#include <QHBoxLayout>
 #include <QLabel>
 #include <QPushButton>
 
@@ -68,3 +69,10 @@ void FontSelector::chooseFont() {
   }
 }
 
+void FontSelector::changeEvent(QEvent *e) {
+  if(e->type() == QEvent::StyleChange) {
+    _demo->setFont(_font);
+  }
+}
+
+
index d7ca9e1..60d2777 100644 (file)
@@ -43,6 +43,9 @@ public slots:
 signals:
   void fontChanged(const QFont &);
 
+protected:
+  void changeEvent(QEvent *e);
+
 protected slots:
   void chooseFont();