[LyX/master] #12451 Adjust color cache on change of dark/light mode
Stephan Witt
switt at lyx.org
Wed Jan 5 06:57:31 UTC 2022
commit d9b9307d14ea5cdf6e6e17d2ccba15048407a3cb
Author: Stephan Witt <switt at lyx.org>
Date: Wed Jan 5 08:26:18 2022 +0100
#12451 Adjust color cache on change of dark/light mode
---
src/frontends/qt/GuiApplication.cpp | 11 +++++++++++
src/frontends/qt/GuiApplication.h | 2 ++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 5cd8f29..b44f2c5 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -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);
}
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index f0c3e1e..e40815e 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -230,6 +230,8 @@ private Q_SLOTS:
///
void onLocaleChanged();
///
+ void onPaletteChanged();
+ ///
void slotProcessFuncRequestQueue() { processFuncRequestQueue(); }
///
#if (QT_VERSION >= 0x050100)
More information about the lyx-cvs
mailing list