summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyle.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-08-12 09:53:52 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-08-12 09:53:52 +0000
commita47cd2cc82ea69b0cb7eab5b4cd11a4838d538d1 (patch)
tree029c5eed2d9237169dd20bb8a868f4ac6a584abf /src/widgets/styles/qstyle.cpp
parente7c17ce78801e547454ed7de947da6330e018fdf (diff)
parent68316e65849b3af4316268312254df79fa28f8c6 (diff)
Merge "Merge remote-tracking branch 'origin/5.4' into 5.5" into refs/staging/5.5
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
-rw-r--r--src/widgets/styles/qstyle.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 13833d2edd..b368477a39 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -541,17 +541,21 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi
QRect result;
int x, y, w, h;
rect.getRect(&x, &y, &w, &h);
+
+ const int pixmapWidth = pixmap.width()/pixmap.devicePixelRatio();
+ const int pixmapHeight = pixmap.height()/pixmap.devicePixelRatio();
+
if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
- y += h/2 - pixmap.height()/2;
+ y += h/2 - pixmapHeight/2;
else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom)
- y += h - pixmap.height();
+ y += h - pixmapHeight;
if ((alignment & Qt::AlignRight) == Qt::AlignRight)
- x += w - pixmap.width();
+ x += w - pixmapWidth;
else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)
- x += w/2 - pixmap.width()/2;
+ x += w/2 - pixmapWidth/2;
else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())
- x += w - pixmap.width();
- result = QRect(x, y, pixmap.width(), pixmap.height());
+ x += w - pixmapWidth;
+ result = QRect(x, y, pixmapWidth, pixmapHeight);
return result;
}