summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qiconloader.cpp
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-11-23 17:03:38 +0100
committerJens Bache-Wiig <jbache@trolltech.com>2009-11-23 17:05:53 +0100
commit1514917196835887c4d4c93cf2522d1a70285c16 (patch)
tree67e195c8de471fc85723af05e58a8a4c10fa07e4 /src/gui/image/qiconloader.cpp
parent23002374d11598b26b6585e78dc073071a13f0ec (diff)
Fixes: Fuzzy standard icons with Ubuntu Humanity theme
Task: QTBUG-6121 RevBy: thorbjorn Details: This icon theme is a bit special in that it uses svg icons even for fixed size entries such as 16x16 icons. An optimization in the icon loader explicitly ignores svgs for such entries so we simply have to remove this check. In addition the actualSize had to be altered to never return a size bigger than the requested size. Otherwise certain menu elements will be bigger than intended.
Diffstat (limited to 'src/gui/image/qiconloader.cpp')
-rw-r--r--src/gui/image/qiconloader.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 15af7a2e4b..ad9bdd0d4e 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -249,21 +249,19 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
const QIconDirInfo &dirInfo = subDirs.at(i);
QString subdir = dirInfo.path;
QDir currentDir(contentDir + subdir);
-
- if (dirInfo.type == QIconDirInfo::Scalable && m_supportsSvg &&
- currentDir.exists(iconName + svgext)) {
- ScalableEntry *iconEntry = new ScalableEntry;
- iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(iconName + svgext);
- entries.append(iconEntry);
-
- } else if (currentDir.exists(iconName + pngext)) {
+ if (currentDir.exists(iconName + pngext)) {
PixmapEntry *iconEntry = new PixmapEntry;
iconEntry->dir = dirInfo;
iconEntry->filename = currentDir.filePath(iconName + pngext);
// Notice we ensure that pixmap entries allways come before
// scalable to preserve search order afterwards
entries.prepend(iconEntry);
+ } else if (m_supportsSvg &&
+ currentDir.exists(iconName + svgext)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = currentDir.filePath(iconName + svgext);
+ entries.append(iconEntry);
}
}
@@ -444,10 +442,8 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size)
/*
* Returns the actual icon size. For scalable svg's this is equivalent
- * to the requested size. Otherwise the closest match is returned.
- *
- * todo: the spec is a bit fuzzy in this area, but we should probably
- * allow scaling down pixmap icons as well.
+ * to the requested size. Otherwise the closest match is returned but
+ * we can never return a bigger size than the requested size.
*
*/
QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
@@ -460,8 +456,10 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
const QIconDirInfo &dir = entry->dir;
if (dir.type == QIconDirInfo::Scalable)
return size;
- else
- return QSize(dir.size, dir.size);
+ else {
+ int result = qMin<int>(dir.size, qMin(size.width(), size.height()));
+ return QSize(result, result);
+ }
}
return QIconEngineV2::actualSize(size, mode, state);
}