diff options
author | Sune Vuorela <sune@vuorela.dk> | 2015-06-15 21:16:24 +0200 |
---|---|---|
committer | Sune Vuorela <sune@vuorela.dk> | 2015-06-18 04:57:02 +0000 |
commit | a8621a3f85e64f1252a80ae81a6e22554f7b3f44 (patch) | |
tree | c0e005017f3981d9b63a19f72d5d8eb2fe276496 /src | |
parent | 0bd936e7f3f3bf54612748f0ade2b43de3ccdb0f (diff) |
Respect manual set icon themes.
Currently all icon resolving is passed thru to the platform icon engine,
even in the case where the application developer has set their own
requested icon theme. In that case, the application developer
specifically does not want to follow the icon theme of the system, so
don't ask the platform, but rely on Qt code instead.
It leads to bugs reported to platform icon theme providers like this:
MMC: https://github.com/MultiMC/MultiMC5/issues/796
KDE: https://bugs.kde.org/show_bug.cgi?id=344469
Thanks to the multimc people (Jan Dalheimer and Peterix) for the
reports and testcases.
Change-Id: I52cda6f688b2ef9e44e060c8ae67831cb02b26c8
Reviewed-by: Eike Hein <hein@kde.org>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qicon.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qiconloader_p.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 40ba84bb14..cafc966fbb 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1170,7 +1170,8 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) icon = *qtIconCache()->object(name); } else { QPlatformTheme * const platformTheme = QGuiApplicationPrivate::platformTheme(); - QIconEngine * const engine = platformTheme ? platformTheme->createIconEngine(name) + bool hasUserTheme = QIconLoader::instance()->hasUserTheme(); + QIconEngine * const engine = (platformTheme && !hasUserTheme) ? platformTheme->createIconEngine(name) : new QIconLoaderEngine(name); QIcon *cachedIcon = new QIcon(engine); icon = *cachedIcon; diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h index 38cf9c1736..5b0362e218 100644 --- a/src/gui/image/qiconloader_p.h +++ b/src/gui/image/qiconloader_p.h @@ -173,6 +173,7 @@ public: void updateSystemTheme(); void invalidateKey() { m_themeKey++; } void ensureInitialized(); + bool hasUserTheme() const { return !m_userTheme.isEmpty(); } private: QThemeIconInfo findIconHelper(const QString &themeName, |