summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2014-01-22 11:01:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 16:32:34 +0100
commit8cf9811ec378b9903e3f64d027f625d9ab0ac7db (patch)
treeb05dd4aa86f8ced239441f85afdaa06473e4c3d2
parent0b250dd628dfd93f4f1077f066976dfab4d9d0fb (diff)
Do not overwrite basePixmap of QIconLoader PixmapEntry
Change-Id: I4799af1d9151ba4b0952369e9620d2fab2b002d9 Reviewed-by: David Sansome <me@davidsansome.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r--src/gui/image/qiconloader.cpp7
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index d202d62957..9e979023cd 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -519,10 +519,11 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
return cachedPixmap;
} else {
if (basePixmap.size() != actualSize)
- basePixmap = basePixmap.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- cachedPixmap = basePixmap;
+ cachedPixmap = basePixmap.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ else
+ cachedPixmap = basePixmap;
if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>(qApp))
- cachedPixmap = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, basePixmap);
+ cachedPixmap = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, cachedPixmap);
QPixmapCache::insert(key, cachedPixmap);
}
return cachedPixmap;
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 2ce6fc5058..bfe2fbc9f7 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -594,7 +594,9 @@ void tst_QIcon::fromTheme()
QCOMPARE(appointmentIcon.pixmap(22).size(), QSize(22, 22)); // exact
QCOMPARE(appointmentIcon.pixmap(32).size(), QSize(32, 32)); // exact
QCOMPARE(appointmentIcon.pixmap(48).size(), QSize(32, 32)); // smaller
+ QCOMPARE(appointmentIcon.pixmap(16).size(), QSize(16, 16)); // scaled down
QCOMPARE(appointmentIcon.pixmap(8).size(), QSize(8, 8)); // scaled down
+ QCOMPARE(appointmentIcon.pixmap(16).size(), QSize(16, 16)); // scaled down
QByteArray ba;
// write to QByteArray