summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2013-07-16 10:44:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-16 20:42:01 +0200
commit5ec344cc7796b8708e2ae722f7cd184c56844504 (patch)
tree8179882624b82a6b791365fc2b1fe46209a9e739 /src
parent9b8b6c7db834fe36f9effdac466decb3cf4a71b7 (diff)
Make *ItemBoundingRect modes work with custom shapes.
Currently, calling QGraphicsScene::items(QPointF(0, 0), Qt::IntersectsItemBoundingRect) or QGraphicsScene::items(QPointF(0, 0), Qt::ContainsItemBoundingRect) will exclude items whose shape does not contain QPointF(0, 0). This is because QGraphicsSceneIndexPointIntersector::intersect() also checks if the point is contained within the shape, instead of just checking if it is contained within the bounding rect. Task-number: QTBUG-19036 Change-Id: Ie701af2a5694d40cf9b3c9c19adbb09a53a4e398 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp
index 4b1c990578..398e72e4c3 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneindex.cpp
@@ -151,7 +151,7 @@ public:
itemd->sceneTransform.dy())
: itemd->sceneTransform.mapRect(brect);
keep = sceneBoundingRect.intersects(QRectF(scenePoint, QSizeF(1, 1)));
- if (keep) {
+ if (keep && (mode == Qt::ContainsItemShape || mode == Qt::IntersectsItemShape)) {
QPointF p = itemd->sceneTransformTranslateOnly
? QPointF(scenePoint.x() - itemd->sceneTransform.dx(),
scenePoint.y() - itemd->sceneTransform.dy())