diff options
Diffstat (limited to 'src/gui/image/qiconloader.cpp')
-rw-r--r-- | src/gui/image/qiconloader.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 1ea4f1340b..228de3adc3 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) /* Theme to use in last resort, if the theme does not have the icon, neither the parents */ -static QString fallbackTheme() +static QString systemFallbackThemeName() { if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconFallbackThemeName); @@ -117,7 +117,7 @@ void QIconLoader::ensureInitialized() m_systemTheme = systemThemeName(); if (m_systemTheme.isEmpty()) - m_systemTheme = fallbackTheme(); + m_systemTheme = systemFallbackThemeName(); if (qt_iconEngineFactoryLoader()->keyMap().key(QLatin1String("svg"), -1) != -1) m_supportsSvg = true; } @@ -137,7 +137,7 @@ void QIconLoader::updateSystemTheme() if (m_userTheme.isEmpty()) { QString theme = systemThemeName(); if (theme.isEmpty()) - theme = fallbackTheme(); + theme = fallbackThemeName(); if (theme != m_systemTheme) { m_systemTheme = theme; invalidateKey(); @@ -151,6 +151,16 @@ void QIconLoader::setThemeName(const QString &themeName) invalidateKey(); } +QString QIconLoader::fallbackThemeName() const +{ + return m_userFallbackTheme.isEmpty() ? systemFallbackThemeName() : m_userFallbackTheme; +} + +void QIconLoader::setFallbackThemeName(const QString &themeName) +{ + m_userFallbackTheme = themeName; +} + void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) { m_iconDirs = searchPaths; @@ -388,7 +398,7 @@ QIconTheme::QIconTheme(const QString &themeName) // Ensure a default platform fallback for all themes if (m_parents.isEmpty()) { - const QString fallback = fallbackTheme(); + const QString fallback = QIconLoader::instance()->fallbackThemeName(); if (!fallback.isEmpty()) m_parents.append(fallback); } @@ -414,7 +424,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName, if (!theme.isValid()) { theme = QIconTheme(themeName); if (!theme.isValid()) - theme = QIconTheme(fallbackTheme()); + theme = QIconTheme(fallbackThemeName()); } const QStringList contentDirs = theme.contentDirs(); |