From 718f248a8921ad310cbb9e099b16f5ffa0c860c1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 31 Jul 2014 14:01:38 +0200 Subject: [PATCH] Fix high DPI icons in menu items The position of high DPI icons is wrong in the Fusion style because the pixel resolution is not taking into account when centering them. Task-number: QTBUG-40277 Change-Id: I3593ed461ea57543c3ddfd473105fdc698789132 Reviewed-by: Friedemann Kleint --- src/widgets/styles/qfusionstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 8db563379a..d1b5bcc95c 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1608,8 +1608,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio else pixmap = menuItem->icon.pixmap(iconSize, mode); - int pixw = pixmap.width(); - int pixh = pixmap.height(); + const int pixw = pixmap.width() / pixmap.devicePixelRatio(); + const int pixh = pixmap.height() / pixmap.devicePixelRatio(); QRect pmr(0, 0, pixw, pixh); pmr.moveCenter(vCheckRect.center());