#12451 Adjust color cache on change of dark/light mode

This commit is contained in:
Stephan Witt 2022-01-05 08:26:18 +01:00
parent d44c63e2c6
commit d9b9307d14
2 changed files with 13 additions and 0 deletions

View File

@ -2322,6 +2322,12 @@ void GuiApplication::onLocaleChanged()
} }
void GuiApplication::onPaletteChanged()
{
colorCache().setPalette(palette());
}
void GuiApplication::handleKeyFunc(FuncCode action) void GuiApplication::handleKeyFunc(FuncCode action)
{ {
char_type c = 0; char_type c = 0;
@ -2977,6 +2983,11 @@ bool GuiApplication::event(QEvent * e)
e->accept(); e->accept();
return true; return true;
#endif #endif
case QEvent::ApplicationPaletteChange: {
// runtime switch from/to dark mode
onPaletteChanged();
return QApplication::event(e);
}
default: default:
return QApplication::event(e); return QApplication::event(e);
} }

View File

@ -230,6 +230,8 @@ private Q_SLOTS:
/// ///
void onLocaleChanged(); void onLocaleChanged();
/// ///
void onPaletteChanged();
///
void slotProcessFuncRequestQueue() { processFuncRequestQueue(); } void slotProcessFuncRequestQueue() { processFuncRequestQueue(); }
/// ///
#if (QT_VERSION >= 0x050100) #if (QT_VERSION >= 0x050100)