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>
This commit is contained in:
Tor Arne Vestbø 2019-06-25 16:24:33 +02:00
parent 96d1d44279
commit da0e745752

View File

@ -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();