Reload stylesheet after changing it in the AppearanceSettingsPage
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 29 Jul 2009 18:32:09 +0000 (20:32 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Aug 2009 18:25:06 +0000 (20:25 +0200)
src/qtui/settingspages/appearancesettingspage.cpp
src/qtui/settingspages/appearancesettingspage.ui
src/uisupport/uistyle.cpp

index e333816..5206430 100644 (file)
@@ -186,8 +186,14 @@ void AppearanceSettingsPage::save() {
 
   _fontsChanged = false;
 
+  bool needsStyleReload =
+        ui.useCustomStyleSheet->isChecked() != ui.useCustomStyleSheet->property("storedValue").toBool()
+    || (ui.useCustomStyleSheet->isChecked() && ui.customStyleSheetPath->text() != ui.customStyleSheetPath->property("storedValue").toString());
+
   SettingsPage::save();
   setChangedState(false);
+  if(needsStyleReload)
+    QtUi::style()->reload();
 }
 
 QLocale AppearanceSettingsPage::selectedLocale() const {
index 69bb680..291881a 100644 (file)
@@ -57,7 +57,7 @@
     </widget>
    </item>
    <item>
-    <widget class="QGroupBox" name="useCustomStylesheet">
+    <widget class="QGroupBox" name="useCustomStyleSheet">
      <property name="title">
       <string>Use Custom Stylesheet</string>
      </property>
index 4964692..35d3162 100644 (file)
@@ -77,15 +77,14 @@ void UiStyle::loadStyleSheet() {
     styleSheet += loadStyleSheet("file:///" + s.value("CustomStyleSheetPath").toString(), true);
   styleSheet += loadStyleSheet("file:///" + Quassel::optionValue("qss"), true);
 
-  if(styleSheet.isEmpty())
-    return;
+  if(!styleSheet.isEmpty()) {
+    QssParser parser;
+    parser.processStyleSheet(styleSheet);
+    QApplication::setPalette(parser.palette());
+    _formatCache = parser.formats();
 
-  QssParser parser;
-  parser.processStyleSheet(styleSheet);
-  QApplication::setPalette(parser.palette());
-  _formatCache = parser.formats();
-
-  qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
+    qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
+  }
 
   emit changed();
 }