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:
parent
ee911e5616
commit
c55324aee0
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user