Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15, 6.5, 6.8, 6.9
-
None
Description
KDE's KIconThemes framework sets palette in a Q_COREAPP_STARTUP_FUNCTION since KIconThemes 6.9 via KColorSchemeManager. This leads to the palette being partially applied, my investigation has pointed to QApplicationPrivate::initializeWidgetPalettesFromTheme() called by QApplicationPrivate::init() which overrides the palette for various widgets. QTimer::singleShot works as a workaround but would be nice if this was solved.
A way to solve this is
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1a0ac0cc3cb..5537bdcc7fa 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1381,14 +1381,14 @@ void QApplicationPrivate::handlePaletteChanged(const char *className) // Palette has been reset back to the default application palette, // so we need to reinitialize the widget palettes from the theme. - if (!className && !testAttribute(Qt::AA_SetPalette)) + if (!className) initializeWidgetPalettesFromTheme(); } void QApplicationPrivate::initializeWidgetPalettesFromTheme() { QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme(); - if (!platformTheme) + if (!platformTheme || testAttribute(Qt::AA_SetPalette)) return; widgetPalettes.clear();