QCommonStyle: use themeHint(IconPixmapSizes) in iconFromWindowsTheme()
Sync iconFromWindowsTheme() to use themeHint(IconPixmapSizes) similar to iconFromMacTheme(). Pick-to: 6.6 Task-number: QTBUG-52622 Change-Id: Id06454b010b1946ee0565190672ee8624cffe2de Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 4d2802702e519c7513440ea485b19ff611696fa1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a13d7d6596
commit
ac04f0397b
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user