Additional support for devicePixelRatio in CE_MenuItem’s icon painting

FusionStyle and MacStyle have this already, the change just brings it to the others.

Task-number: QTBUG-40277
Change-Id: I08dc80771b9cd0ab47179e1994ab6510b022eade
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
MihailNaydenov 2014-09-24 14:01:31 +03:00 committed by Friedemann Kleint
parent ee911e5616
commit c55324aee0
6 changed files with 12 additions and 12 deletions

View File

@ -3235,8 +3235,8 @@ void QGtkStyle::drawControl(ControlElement element,
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() - QPoint(0, 1));
painter->setPen(menuItem->palette.text().color());

View File

@ -3573,8 +3573,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
else
pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
QRenderRule iconRule = renderRule(w, opt, PseudoElement_MenuIcon);
if (!iconRule.hasGeometry()) {
iconRule.geo = new QStyleSheetGeometryData(pixw, pixh, pixw, pixh, -1, -1);

View File

@ -671,8 +671,8 @@ void QWindowsCEStyle::drawControl(ControlElement element, const QStyleOption *op
pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
else
pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
if (act && !dis && !checked)
qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1,
&menuitem->palette.brush(QPalette::Button));

View File

@ -1145,8 +1145,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
else
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
if (act && !dis && !checked)
qDrawShadePanel(p, vCheckRect, menuitem->palette, false, 1,
&menuitem->palette.brush(QPalette::Button));

View File

@ -1275,8 +1275,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
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);
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());
painter->setPen(menuitem->palette.text().color());

View File

@ -2246,8 +2246,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QPixmap pixmap = checked ?
menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
const int pixw = pixmap.width() / pixmap.devicePixelRatio();
const int pixh = pixmap.height() / pixmap.devicePixelRatio();
QRect iconRect(0, 0, pixw, pixh);
iconRect.moveCenter(QRect(xpos, y, checkcol, h).center());
QRect vIconRect = visualRect(option->direction, option->rect, iconRect);