Update QIconLoader system theme unconditionally on ThemeChange

We cache the system theme name in QIconLoader, so when a theme change
comes in we need to update the system icon theme name regardless of
whether a user theme has been set.

The updated system theme name will not be reflected through the
QiconLoader::themeNamed() unless the user theme is cleared/unset.

Change-Id: Id949e55e2fa12e40818ba54cf2a10ce48fe10815
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 883c3dc8c8c014528e77ecbc4b4ed7d7504afa42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-06-12 13:26:21 +02:00 committed by Qt Cherry-pick Bot
parent dc7a2d20f8
commit 6c69eb4021

View File

@ -119,20 +119,15 @@ QIconLoader *QIconLoader::instance()
// icons if the theme has changed.
void QIconLoader::updateSystemTheme()
{
// Only change if this is not explicitly set by the user
if (m_userTheme.isEmpty()) {
QString theme = systemThemeName();
if (theme.isEmpty())
theme = fallbackThemeName();
if (theme != m_systemTheme) {
m_systemTheme = theme;
const QString currentSystemTheme = m_systemTheme;
m_systemTheme = systemThemeName();
if (m_systemTheme.isEmpty())
m_systemTheme = fallbackThemeName();
if (m_systemTheme != currentSystemTheme) {
qCDebug(lcIconLoader) << "Updated system theme to" << m_systemTheme;
if (!hasUserTheme())
invalidateKey();
}
} else {
qCDebug(lcIconLoader) << "Ignoring system theme update because"
<< "user theme" << m_userTheme << "has been set";
}
}
void QIconLoader::invalidateKey()