]> git.lyx.org Git - features.git/commitdiff
#12451 Adjust color cache on change of dark/light mode
authorStephan Witt <switt@lyx.org>
Wed, 5 Jan 2022 07:26:18 +0000 (08:26 +0100)
committerStephan Witt <switt@lyx.org>
Wed, 5 Jan 2022 07:26:45 +0000 (08:26 +0100)
src/frontends/qt/GuiApplication.cpp
src/frontends/qt/GuiApplication.h

index 5cd8f290d4866ea2df16bedf685040e009970e45..b44f2c56b27149d133706bea0fddee3ea09a15c7 100644 (file)
@@ -2322,6 +2322,12 @@ void GuiApplication::onLocaleChanged()
 }
 
 
+void GuiApplication::onPaletteChanged()
+{
+       colorCache().setPalette(palette());
+}
+
+
 void GuiApplication::handleKeyFunc(FuncCode action)
 {
        char_type c = 0;
@@ -2977,6 +2983,11 @@ bool GuiApplication::event(QEvent * e)
                e->accept();
                return true;
 #endif
+       case QEvent::ApplicationPaletteChange: {
+               // runtime switch from/to dark mode
+               onPaletteChanged();
+               return QApplication::event(e);
+       }
        default:
                return QApplication::event(e);
        }
index f0c3e1ea7572352e2a51f9ae59c9520bd3cb05ca..e40815e8be2495337cd92e152f033b1e11395fca 100644 (file)
@@ -230,6 +230,8 @@ private Q_SLOTS:
        ///
        void onLocaleChanged();
        ///
+       void onPaletteChanged();
+       ///
        void slotProcessFuncRequestQueue() { processFuncRequestQueue(); }
        ///
 #if (QT_VERSION >= 0x050100)