Fixed tst_QIcon::task184901_badCache().
QIcon has not been moved to QtGui after all, re-introduce QtWidgets-dependent code path. Task-number: QTBUG-21402 Change-Id: I61c37babaeceadf7d53c10736bcc847758adaf1b Reviewed-on: http://codereview.qt-project.org/4775 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>bb10
parent
d6f971c854
commit
b6389bb6d4
|
|
@ -54,7 +54,7 @@
|
|||
#include "qcache.h"
|
||||
#include "qdebug.h"
|
||||
#include "private/qguiplatformplugin_p.h"
|
||||
#include "qguiapplication.h"
|
||||
#include "qapplication.h"
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include <private/qt_mac_p.h>
|
||||
|
|
@ -264,37 +264,37 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
|
|||
actualSize.scale(size, Qt::KeepAspectRatio);
|
||||
|
||||
// #### Qt5 no idea what this really does, but we need to remove the QApp and style references
|
||||
// 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());
|
||||
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 % HexString<uint>(mode), pm))
|
||||
// return pm; // horray
|
||||
// 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);
|
||||
// if (pm.cacheKey() == active.cacheKey())
|
||||
// return pm;
|
||||
// }
|
||||
// }
|
||||
if (mode == QIcon::Active) {
|
||||
if (QPixmapCache::find(key % HexString<uint>(mode), pm))
|
||||
return pm; // horray
|
||||
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);
|
||||
if (pm.cacheKey() == active.cacheKey())
|
||||
return pm;
|
||||
}
|
||||
}
|
||||
|
||||
// if (!QPixmapCache::find(key % HexString<uint>(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) {
|
||||
// QStyleOption opt(0);
|
||||
// opt.palette = QApplication::palette();
|
||||
// QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt);
|
||||
// if (!generated.isNull())
|
||||
// pm = generated;
|
||||
// }
|
||||
// QPixmapCache::insert(key % HexString<uint>(mode), pm);
|
||||
// }
|
||||
if (pe->mode != mode && mode != QIcon::Normal) {
|
||||
QStyleOption opt(0);
|
||||
opt.palette = QApplication::palette();
|
||||
QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt);
|
||||
if (!generated.isNull())
|
||||
pm = generated;
|
||||
}
|
||||
QPixmapCache::insert(key % HexString<uint>(mode), pm);
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,5 +28,3 @@ wince* {
|
|||
} else {
|
||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||
}
|
||||
|
||||
CONFIG += insignificant_test # QTBUG-21402
|
||||
|
|
|
|||
Loading…
Reference in New Issue