diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-11-23 16:03:38 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-11-23 16:05:53 (GMT) |
commit | 1514917196835887c4d4c93cf2522d1a70285c16 (patch) | |
tree | 67e195c8de471fc85723af05e58a8a4c10fa07e4 /src/gui/image | |
parent | 23002374d11598b26b6585e78dc073071a13f0ec (diff) | |
download | Qt-1514917196835887c4d4c93cf2522d1a70285c16.zip Qt-1514917196835887c4d4c93cf2522d1a70285c16.tar.gz Qt-1514917196835887c4d4c93cf2522d1a70285c16.tar.bz2 |
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')
-rw-r--r-- | src/gui/image/qiconloader.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 15af7a2..ad9bdd0 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); } |