summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorKevin Ottens <ervin@kde.org>2013-02-01 08:15:50 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-19 10:35:06 +0100
commitfc6b21436347f21c8a228bb0e256d946936095a2 (patch)
tree0669123527b1bd229498b5a8854871a958229d67 /src/gui/image
parent388f4f16b03949bbfc6bc8b18491ab16a43c484d (diff)
Let QPlatformTheme decide which engine QIcon::fromTheme uses
By default we still use QIconLoaderEngine but now platform theme plugins have the opportunity to override that. It is in particular planned to be used in a WIP platform theme plugin for KDE sessions. Change-Id: I07a82dc91daea44709b3a790f3f6e2a7a090d108 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index dce902301c..6b91ead666 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -60,6 +60,7 @@
#include "private/qhexstring_p.h"
#include "private/qguiapplication_p.h"
+#include "qpa/qplatformtheme.h"
#ifndef QT_NO_ICON
QT_BEGIN_NAMESPACE
@@ -986,7 +987,10 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
if (qtIconCache()->contains(name)) {
icon = *qtIconCache()->object(name);
} else {
- QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name));
+ QPlatformTheme * const platformTheme = QGuiApplicationPrivate::platformTheme();
+ QIconEngine * const engine = platformTheme ? platformTheme->createIconEngine(name)
+ : new QIconLoaderEngine(name);
+ QIcon *cachedIcon = new QIcon(engine);
qtIconCache()->insert(name, cachedIcon);
icon = *cachedIcon;
}