summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-08-05 18:19:11 +0200
committerJens Bache-Wiig <jbache@trolltech.com>2009-08-11 15:39:10 +0200
commitd82ab0709286f6b6816064affee4705d821830ec (patch)
treebaf3aac1b528e43013888ba7293088afd5db1d16 /src
parentd117525a4ff8757208231fa77f171c7fd7a30ef9 (diff)
downloadqt4-tools-d82ab0709286f6b6816064affee4705d821830ec.tar.gz
Make QIconloader use resource directory as fallback
Instead of using different paths on Mac and Windows we now simply use ":\icons" on all platforms. It is a little more effort to create resources but it is certainly the Qt way to do it. :) Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qicon.cpp13
-rw-r--r--src/gui/image/qiconloader.cpp7
2 files changed, 9 insertions, 11 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4ea6af196..e23677fe70 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -888,10 +888,9 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
On X11, the search path will use the XDG_DATA_DIRS environment
variable if available.
- On Windows the search path defaults to [Application Directory]/icons
-
- On Mac the default search path will search in the
- [Contents/Resources/icons] part of the application bundle.
+ By default all platforms will have the resource directory
+ ":\icons" as their fallback. You can use "rcc -project"
+ to generate a resource file from your icon theme.
\sa setThemeSearchPaths(), fromTheme(), setThemeName()
*/
@@ -906,7 +905,7 @@ QStringList QIcon::themeSearchPaths()
Sets the current icon theme to \a name.
The \a name should correspond to a directory name in the
- current themeSearchPath() containing an index.theme
+ themeSearchPath() containing an index.theme
file describing it's contents.
\sa themeSearchPaths(), themeName()
@@ -939,10 +938,6 @@ QString QIcon::themeName()
icon theme. If no such icon is found in the current theme
\a fallback is return instead.
- To use an icon theme on Windows or Mac, you will need to
- bundle a compliant theme with your application and make sure
- it is located in your themeSarchPaths.
-
The lastest version of the freedesktop icon specification and naming
spesification can be obtained here:
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 279703cd0a..cb1cc611aa 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -187,14 +187,17 @@ QStringList QIconLoader::themeSearchPaths() const
QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
if (homeDir.exists())
m_iconDirs.prepend(homeDir.path());
-
-#elif defined(Q_WS_WIN)
+#endif
+
+#if defined(Q_WS_WIN)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/icons"));
#elif defined(Q_WS_MAC)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/../Resources/icons"));
#endif
+ // Allways add resource directory as search path
+ m_iconDirs.append(QLatin1String(":/icons"));
}
return m_iconDirs;
}