From 2cd2cba0868efb7e8dd2d00805f1a5ceed0a1349 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Jul 2016 14:00:14 +0200 Subject: QtPlatformSupport: Add QAbstractFileIconEngine Move the code from QtWidgets/QFileIconEngine into a new class with virtuals in QtPlatformSupport so that platforms can reuse it. Prototypically use the class in the Windows and macOS QPA plugins. Remove QPlatformTheme::fileIconPixmap() and change the type of the hint QPlatformTheme::IconPixmapSizes from QList to QList so that it fits better with the icon code. Change-Id: I580e936f3507218757565ca099272cd575b3a779 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qcommonstyle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/styles') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 36975c5877..6cdfc061e1 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5913,14 +5913,14 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { QPlatformTheme::StandardPixmap sp = static_cast(standardIcon); QIcon retIcon; - QList sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value >(); - Q_FOREACH (int size, sizes) { + const QList sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value >(); + for (const QSize &size : sizes) { QPixmap mainIcon; - const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size); + const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size.width()); if (standardIcon >= QStyle::SP_CustomBase) { - mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); + mainIcon = theme->standardPixmap(sp, QSizeF(size)); } else if (QPixmapCache::find(cacheKey, mainIcon) == false) { - mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); + mainIcon = theme->standardPixmap(sp, QSizeF(size)); QPixmapCache::insert(cacheKey, mainIcon); } -- cgit v1.2.3