summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qiconengine.cpp
diff options
context:
space:
mode:
authorAurelien Gateau <agateau@kde.org>2010-04-20 13:49:14 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-04-20 13:50:53 +0200
commita057a48cbac8acbf54a121c63a795480d3f9a8c0 (patch)
tree6142bfdeb4e7185c76c64acc1a852a4fe88d0a93 /src/gui/image/qiconengine.cpp
parent434d2312b63090cfd2ba7e0f3728b5b225bcaeec (diff)
Added QIcon::name()
This only works with icons loaded with QIcon::fromTheme() for now. Merge-request: 2367 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Reviewed-by: jbache
Diffstat (limited to 'src/gui/image/qiconengine.cpp')
-rw-r--r--src/gui/image/qiconengine.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp
index 4c7c7287b7..050d48d525 100644
--- a/src/gui/image/qiconengine.cpp
+++ b/src/gui/image/qiconengine.cpp
@@ -183,6 +183,10 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
that should be filled with icon sizes. Engines that work in terms
of a scalable, vectorial format normally return an empty list.
+ \value IconNameHook Allows to query the name used to create the
+ icon, for example when instantiating an icon using
+ QIcon::fromTheme().
+
\sa virtual_hook()
*/
@@ -301,4 +305,20 @@ QList<QSize> QIconEngineV2::availableSizes(QIcon::Mode mode, QIcon::State state)
return arg.sizes;
}
+/*!
+ \since 4.7
+
+ Returns the name used to create the engine, if available.
+
+ \note This is a helper method and the actual work is done by
+ virtual_hook() method, hence this method depends on icon engine support
+ and may not work with all icon engines.
+ */
+QString QIconEngineV2::iconName()
+{
+ QString name;
+ virtual_hook(QIconEngineV2::IconNameHook, reinterpret_cast<void*>(&name));
+ return name;
+}
+
QT_END_NAMESPACE