QIconLoader: reset search paths when theme name is cleared

When we reset the theme so that icons should be provided by the
system theme, then reset the search paths to the system-provided
paths as well. Otherwise we'll keep looking for the system theme
in user-provided search paths, which can't work.

Change-Id: I10bcb404db9924e038f6fdc8970e53bbb69ac7d1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e1a93b3d9a9f18013b28b4136866a76df11c2ea1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2023-07-20 02:35:53 +02:00 committed by Qt Cherry-pick Bot
parent b01710cba8
commit bd55ecbbce

View File

@ -151,7 +151,13 @@ void QIconLoader::setThemeName(const QString &themeName)
qCDebug(lcIconLoader) << "Setting user theme name to" << themeName;
const bool hadUserTheme = hasUserTheme();
m_userTheme = themeName;
// if we cleared the user theme, then reset search paths as well,
// otherwise we'll keep looking in the user-defined search paths for
// a system-provide theme, which will never work.
if (!hasUserTheme() && hadUserTheme)
setThemeSearchPath(systemIconSearchPaths());
invalidateKey();
}