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. Pick-to: 6.6 6.5 Change-Id: Id949e55e2fa12e40818ba54cf2a10ce48fe10815 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>bb10
parent
76619eae4c
commit
883c3dc8c8
|
|
@ -119,19 +119,14 @@ 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;
|
||||
qCDebug(lcIconLoader) << "Updated system theme to" << m_systemTheme;
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue