summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qicon.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-08-16 15:42:41 +0200
committerAlbert Astals Cid <aacid@kde.org>2018-08-20 21:42:58 +0000
commit0e7724079f1eae283714ae12769d1372b8f85659 (patch)
treec07ae322b1b0012795be07c7ce485e63fc273ab0 /src/gui/image/qicon.cpp
parent67cc8fea106c35c7ca75bf476667d07b3bbf3257 (diff)
Allow setting the QIcon fallback theme
This allows apps that know their icons are in a given icon theme to set that theme as fallback, so in case the user theme does not include them, the icons can still be found. This solves the problem of missing icons that often happens when running KDE applications on a GNOME desktop. Change-Id: I4e5543d598012352a29ff79dab0357506d986b6d Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r--src/gui/image/qicon.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 32fa9e75ac..14a0248600 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1194,7 +1194,7 @@ void QIcon::setFallbackSearchPaths(const QStringList &paths)
The \a name should correspond to a directory name in the
themeSearchPath() containing an index.theme
- file describing it's contents.
+ file describing its contents.
\sa themeSearchPaths(), themeName()
*/
@@ -1220,6 +1220,37 @@ QString QIcon::themeName()
}
/*!
+ \since 5.12
+
+ Returns the name of the fallback icon theme.
+
+ On X11, if not set, the fallback icon theme depends on your desktop
+ settings. On other platforms it is not set by default.
+
+ \sa setFallbackThemeName(), themeName()
+*/
+QString QIcon::fallbackThemeName()
+{
+ return QIconLoader::instance()->fallbackThemeName();
+}
+
+/*!
+ \since 5.12
+
+ Sets the fallback icon theme to \a name.
+
+ The \a name should correspond to a directory name in the
+ themeSearchPath() containing an index.theme
+ file describing its contents.
+
+ \sa fallbackThemeName(), themeSearchPaths(), themeName()
+*/
+void QIcon::setFallbackThemeName(const QString &name)
+{
+ QIconLoader::instance()->setFallbackThemeName(name);
+}
+
+/*!
\since 4.6
Returns the QIcon corresponding to \a name in the current