diff options
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r-- | src/gui/image/qicon.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 891b1db..a2f429a 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -66,6 +66,8 @@ #include "private/qkde_p.h" #endif +#include "private/qstylehelper_p.h" + #ifndef QT_NO_ICON QT_BEGIN_NAMESPACE @@ -261,21 +263,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); - QString key = QLatin1String("$qt_icon_") - + QString::number(pm.cacheKey()) - + QString::number(pe->mode) - + QString::number(QApplication::palette().cacheKey()) - + QLatin1Char('_') - + QString::number(actualSize.width()) - + QLatin1Char('_') - + QString::number(actualSize.height()) - + QLatin1Char('_'); - + QString key = QLatin1Literal("qt_") + % 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); @@ -284,7 +282,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) { @@ -294,7 +292,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; } |