summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-12-11 12:07:51 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-01-09 04:30:58 +0100
commit4d2802702e519c7513440ea485b19ff611696fa1 (patch)
treed93d1718ee24d7bab167693312a7bcf5a904e83f /src/widgets/styles/qcommonstyle.cpp
parent94809cdec004611bdb8531304e6c74761014876b (diff)
QCommonStyle: use themeHint(IconPixmapSizes) in iconFromWindowsTheme()
Sync iconFromWindowsTheme() to use themeHint(IconPixmapSizes) similar to iconFromMacTheme(). Pick-to: 6.7 6.6 Task-number: QTBUG-52622 Change-Id: Id06454b010b1946ee0565190672ee8624cffe2de Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/widgets/styles/qcommonstyle.cpp')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index e0fe118761..54306fddb7 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5617,8 +5617,9 @@ QIcon QCommonStylePrivate::iconFromWindowsTheme(QCommonStyle::StandardPixmap sta
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon);
const auto dpr = qt_getDevicePixelRatio(widget);
- for (const int size : {16, 32}) {
- QPixmap pixmap = theme->standardPixmap(sp, QSizeF(size, size) * dpr);
+ const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize>>();
+ for (const QSize &size : sizes) {
+ QPixmap pixmap = theme->standardPixmap(sp, size * dpr);
pixmap.setDevicePixelRatio(dpr);
icon.addPixmap(pixmap, QIcon::Normal);
}
@@ -5631,8 +5632,9 @@ QIcon QCommonStylePrivate::iconFromWindowsTheme(QCommonStyle::StandardPixmap sta
QPlatformTheme::StandardPixmap spOn = standardIcon == QStyle::SP_DirIcon ? QPlatformTheme::DirOpenIcon
: QPlatformTheme::DirLinkOpenIcon;
const auto dpr = qt_getDevicePixelRatio(widget);
- for (const int size : {16, 32}) {
- const QSizeF pixSize = QSizeF(size, size) * dpr;
+ const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize>>();
+ for (const QSize &size : sizes) {
+ const QSizeF pixSize = size * dpr;
QPixmap pixmap = theme->standardPixmap(spOff, pixSize);
pixmap.setDevicePixelRatio(dpr);
icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);