summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qiconloader_p.h
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2017-12-20 16:03:42 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2018-01-15 10:12:22 +0000
commit85aa0fd041fbaa258f089d86f227311e53f6206a (patch)
treebafaed0633d4034232af4a9d725d009e0c2a7155 /src/gui/image/qiconloader_p.h
parent537af273026eaf0a18d2151ad6928b7797d7955b (diff)
Introduce QIcon::fallbackSearchPaths()
... that will be used if an icon can't be found in the current theme. The Icon Theme Specification https://standards.freedesktop.org/icon-theme-spec/latest/ar01s05.html states that unthemed icons must be searched in the base directories, i.e. /usr/share/icons, ... But in practice unthemed icons are installed into /usr/share/pixmaps and this dir is not used as a base dir for icon themes. So it's better to explicitly specify fallback dirs to avoid needless access to the filesystem. Also some KDE application install their own unthemed icons (into /usr/share/<appname>/pics), that can't be found by QIconLoader. With this change it would be possible for them to specify dirs with unthemed icons and thus be displayed correctly in non-KDE environments. [ChangeLog][QtGui][QIcon] Added fallbackSearchPaths() that will be used to find icons missing in the current icon theme. Change-Id: I0dc55ba958b29356a3b0a2123d6b8faa24d4c91e Task-number: QTBUG-33123 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/image/qiconloader_p.h')
-rw-r--r--src/gui/image/qiconloader_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 0007437ee9..746e871fb1 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -69,7 +69,7 @@ class QIconLoader;
struct QIconDirInfo
{
- enum Type { Fixed, Scalable, Threshold };
+ enum Type { Fixed, Scalable, Threshold, Fallback };
QIconDirInfo(const QString &_path = QString()) :
path(_path),
size(0),
@@ -180,6 +180,8 @@ public:
QIconTheme theme() { return themeList.value(themeName()); }
void setThemeSearchPath(const QStringList &searchPaths);
QStringList themeSearchPaths() const;
+ void setFallbackSearchPaths(const QStringList &searchPaths);
+ QStringList fallbackSearchPaths() const;
QIconDirInfo dirInfo(int dirindex);
static QIconLoader *instance();
void updateSystemTheme();
@@ -191,6 +193,8 @@ private:
QThemeIconInfo findIconHelper(const QString &themeName,
const QString &iconName,
QStringList &visited) const;
+ QThemeIconInfo lookupFallbackIcon(const QString &iconName) const;
+
uint m_themeKey;
bool m_supportsSvg;
bool m_initialized;
@@ -199,6 +203,7 @@ private:
mutable QString m_systemTheme;
mutable QStringList m_iconDirs;
mutable QHash <QString, QIconTheme> themeList;
+ mutable QStringList m_fallbackDirs;
};
QT_END_NAMESPACE