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>
bb10
Sune Vuorela 2015-06-15 21:16:24 +02:00
parent 0bd936e7f3
commit a8621a3f85
2 changed files with 3 additions and 1 deletions

View File

@ -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;

View File

@ -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,