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>
bb10
Morten Johan Sørvig 2014-03-12 11:01:26 +01:00 committed by The Qt Project
parent 0b7beaaaf2
commit ffc8aac684
1 changed files with 2 additions and 2 deletions

View File

@ -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());
}
}