Vista Style: Use correct action icon pixmaps matching the device pixel ratio

Extend change 5911335756 to the Vista
style (using the paint device's ratio).

Pick-to: 6.4
Fixes: QTBUG-108440
Task-number: QTBUG-85885
Change-Id: Ib0b5fcc943a18896b770b382b39bbb684238a618
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Friedemann Kleint 2022-12-12 15:11:00 +01:00
parent 725b641d87
commit 2d20406f59

View File

@ -2949,11 +2949,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
if (act && !dis)
mode = QIcon::Active;
QPixmap pixmap;
if (checked)
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On);
else
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
const auto size = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
const auto dpr = painter->device()->devicePixelRatio();
const auto pixmap = menuitem->icon.pixmap({size, size}, dpr, mode,
checked ? QIcon::On : QIcon::Off);
QRect pmr(QPoint(0, 0), pixmap.deviceIndependentSize().toSize());
pmr.moveCenter(vCheckRect.center());
painter->setPen(menuitem->palette.text().color());