summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qicon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r--src/gui/image/qicon.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 9f1eea2..7696632 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -55,6 +55,7 @@
#include "qcache.h"
#include "qdebug.h"
#include "private/qguiplatformplugin_p.h"
+#include "private/qstylehelper_p.h"
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
@@ -261,24 +262,17 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
actualSize.scale(size, Qt::KeepAspectRatio);
- int digits = sizeof(qint64)/sizeof(QChar);
- quint64 tkey = pm.cacheKey(),
- tmode = pe->mode,
- tpalkey = QApplication::palette().cacheKey(),
- twidth = actualSize.width(),
- theight = actualSize.height();
-
QString key = QLatin1Literal("qt_")
- % QString::fromRawData((QChar*)&tkey, digits)
- % QString::fromRawData((QChar*)&tmode, digits)
- % QString::fromRawData((QChar*)&tpalkey, digits)
- % QString::fromRawData((QChar*)&twidth, digits)
- % QString::fromRawData((QChar*)&theight, digits);
+ % HexString<quint64>(pm.cacheKey())
+ % HexString<uint>(pe->mode)
+ % HexString<quint64>(QApplication::palette().cacheKey())
+ % HexString<uint>(actualSize.width())
+ % HexString<uint>(actualSize.height());
if (mode == QIcon::Active) {
- if (QPixmapCache::find(key + QString::number(mode), pm))
+ if (QPixmapCache::find(key % HexString<uint>(mode), pm))
return pm; // horray
- if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) {
+ if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
QStyleOption opt(0);
opt.palette = QApplication::palette();
QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
@@ -287,7 +281,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
}
}
- if (!QPixmapCache::find(key + QString::number(mode), pm)) {
+ if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (pe->mode != mode && mode != QIcon::Normal) {
@@ -297,7 +291,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!generated.isNull())
pm = generated;
}
- QPixmapCache::insert(key + QString::number(mode), pm);
+ QPixmapCache::insert(key % HexString<uint>(mode), pm);
}
return pm;
}