diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-07-17 17:53:19 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-07-17 17:53:19 +0200 |
commit | 68316e65849b3af4316268312254df79fa28f8c6 (patch) | |
tree | 58d99a204fe8666b7de4d400af2ee4042635c0e9 /src/widgets/styles/qstyle.cpp | |
parent | 954f0d93976362d29044439e4eaa11d2dff16624 (diff) | |
parent | 4a1e5dbade4bab55f39bd368480dcca9a11e4b38 (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
doc/global/manifest-meta.qdocconf
src/corelib/global/qnamespace.qdoc
src/corelib/io/qstorageinfo_unix.cpp
src/corelib/tools/qtools_p.h
src/sql/drivers/psql/qsql_psql.cpp
Change-Id: I23a15ac84e03ad61d865e3df872b013eb0752949
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 5e51866d8f..d11d717a1b 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; } |