From a8621a3f85e64f1252a80ae81a6e22554f7b3f44 Mon Sep 17 00:00:00 2001 From: Sune Vuorela Date: Mon, 15 Jun 2015 21:16:24 +0200 Subject: [PATCH 055/299] 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 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/image/qicon.cpp | 3 ++- src/gui/image/qiconloader_p.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 40ba84b..cafc966 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 38cf9c1..5b0362e 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, -- 2.4.3