From bd55ecbbce00de1071154ca58dfea17411bad48d Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 20 Jul 2023 02:35:53 +0200 Subject: [PATCH] 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 (cherry picked from commit e1a93b3d9a9f18013b28b4136866a76df11c2ea1) Reviewed-by: Qt Cherry-pick Bot --- src/gui/image/qiconloader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 19829c3d1fd..5f6ce0bbc7d 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -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(); }