Windows: Handle theme switching correctly if a palette is set

If a palette is set on the application object and the user does
something to trigger a theme change, i.e. connects via remote desktop
or logs out and in again, then it will cause Qt to render incorrectly.
Therefore we should only update the palette from the new theme if we
don't have our own already set.

Task-number: QTBUG-52962
Change-Id: I4e2288efd82ad98b698cc09f26ad188064ec7b2a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Andy Shaw 2016-07-04 08:07:42 +02:00
parent a9613ba3f1
commit 8f85e82c5d

View File

@ -3567,7 +3567,8 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape)
void QGuiApplicationPrivate::notifyThemeChanged()
{
if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet)) {
if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) &&
!QCoreApplication::testAttribute(Qt::AA_SetPalette)) {
clearPalette();
initPalette();
}