diff options
author | Aurelien Gateau <agateau@kde.org> | 2010-04-20 11:49:14 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-04-20 11:50:53 (GMT) |
commit | a057a48cbac8acbf54a121c63a795480d3f9a8c0 (patch) | |
tree | 6142bfdeb4e7185c76c64acc1a852a4fe88d0a93 /src/gui/image/qicon.cpp | |
parent | 434d2312b63090cfd2ba7e0f3728b5b225bcaeec (diff) | |
download | Qt-a057a48cbac8acbf54a121c63a795480d3f9a8c0.zip Qt-a057a48cbac8acbf54a121c63a795480d3f9a8c0.tar.gz Qt-a057a48cbac8acbf54a121c63a795480d3f9a8c0.tar.bz2 |
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/qicon.cpp')
-rw-r--r-- | src/gui/image/qicon.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index fad51f4..bc52e99 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -879,6 +879,25 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const } /*! + \since 4.7 + + Returns the name used to create the icon, if available. + + Depending on the way the icon was created, it may have an associated + name. This is the case for icons created with fromTheme() or icons + using a QIconEngine which supports the QIconEngineV2::IconNameHook. + + \sa fromTheme(), QIconEngine +*/ +QString QIcon::name() const +{ + if (!d || !d->engine || d->engine_version < 2) + return QString(); + QIconEngineV2 *engine = static_cast<QIconEngineV2*>(d->engine); + return engine->iconName(); +} + +/*! \since 4.6 Sets the search paths for icon themes to \a paths. |