summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-06-21 13:40:50 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-12-12 17:22:18 +0100
commit14071b5a8e15b1f9ce0bf601a96ae365fa8983aa (patch)
tree30417bf6a0c43d73d8bae9c0dadfaaf1246f9769
parentf733c1c6e70e14fa64923f6601273d3a7d7f2325 (diff)
Clarify call to initializeWidgetFontHash in QApplication::setStyle
The call was added in c49c96fbb13912, "Reinitialize system palette when setting a new style", but adding it along with the palette code seems like a mistake. The potentially dirty widget font hash needs to be reset for all style changes. Change-Id: I411f56bb833819213c5485d7585fc5e3e9bd8983 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/widgets/kernel/qapplication.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index dfa1bc23b1..b3938df78a 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1133,12 +1133,18 @@ void QApplication::setStyle(QStyle *style)
} else if (QApplicationPrivate::sys_pal) {
clearSystemPalette();
initSystemPalette();
- QApplicationPrivate::initializeWidgetFontHash();
} else if (!QApplicationPrivate::sys_pal) {
// Initialize the sys_pal if it hasn't happened yet...
QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette());
}
+ // The default widget font hash is based on the platform theme,
+ // not the style, but the widget fonts could in theory have been
+ // affected by polish of the previous style, without a proper
+ // cleanup in unpolish, so reset it now before polishing the
+ // new style.
+ QApplicationPrivate::initializeWidgetFontHash();
+
// initialize the application with the new style
QApplicationPrivate::app_style->polish(qApp);