summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-03-12 11:01:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 09:15:15 +0100
commitffc8aac684e97bad1fb598883fa05ae66f7f1e4c (patch)
tree2e0694728d31921a57ac3555446a1a696bb35e83 /src/widgets
parent0b7beaaaf2384fae01ae403737450a59b2fcabac (diff)
Fix high-dpi QGraphicsPixmapItem bounding rects.
QGraphicsPixmapItem did not take the pixmaps devicePixelRatio into account when calculating the bounding rect. As a consequence, a 512x512@2x pixmap would get a 512x512 bounding size instead of the correct 256x256 bounding size. Task-number: QTBUG-37008 Change-Id: I266e418b7e5d92bf1d4c96bd9380a27708dc2b4a Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 292b0419ca..f1b3d95f9c 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -9592,9 +9592,9 @@ QRectF QGraphicsPixmapItem::boundingRect() const
return QRectF();
if (d->flags & ItemIsSelectable) {
qreal pw = 1.0;
- return QRectF(d->offset, d->pixmap.size()).adjusted(-pw/2, -pw/2, pw/2, pw/2);
+ return QRectF(d->offset, d->pixmap.size() / d->pixmap.devicePixelRatio()).adjusted(-pw/2, -pw/2, pw/2, pw/2);
} else {
- return QRectF(d->offset, d->pixmap.size());
+ return QRectF(d->offset, d->pixmap.size() / d->pixmap.devicePixelRatio());
}
}