diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-06-25 16:24:33 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-12-12 23:24:25 +0100 |
commit | da0e7457523a5c6867c2d9b9f0346167738f0323 (patch) | |
tree | 62c83cb3fd8b88cfc1acdfaa3ce4093d53021f9b /src/widgets/kernel | |
parent | 96d1d44279dc582355c21956fee99d945888fb07 (diff) |
Explicitly polish palette instead of relying on QApplication::setPalette
The only effect calling QApplication::setPalette will have is the polish,
so opt for doing it explicitly instead of the weirdly looking no-op
assignment.
Change-Id: Ia80b3f60e3e513b68c2993ea8417966f9ab6721e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1f26e6e41c..2a1a21596c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1057,8 +1057,8 @@ QStyle *QApplication::style() initSystemPalette(); - if (QApplicationPrivate::set_pal) // Re-polish set palette with the new style - QApplication::setPalette(*QApplicationPrivate::set_pal); + if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) + defaultStyle->polish(*explicitlySetPalette); #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty()) { @@ -1132,8 +1132,8 @@ void QApplication::setStyle(QStyle *style) // take care of possible palette requirements of certain gui // styles. Do it before polishing the application since the style // might call QApplication::setPalette() itself - if (QApplicationPrivate::set_pal) { - QApplication::setPalette(*QApplicationPrivate::set_pal); + if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) { + QApplicationPrivate::app_style->polish(*explicitlySetPalette); } else { if (QApplicationPrivate::sys_pal) clearSystemPalette(); |