summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-26 14:32:27 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-26 14:57:10 (GMT)
commiteff4c4b4172d1a95b1b5806622b4e7fe43c2b006 (patch)
tree7ed886341e69b426a209ed1330d4facded7e2431 /src
parent7541247a025bf112716a752bc4d114303f2a77f8 (diff)
downloadQt-eff4c4b4172d1a95b1b5806622b4e7fe43c2b006.zip
Qt-eff4c4b4172d1a95b1b5806622b4e7fe43c2b006.tar.gz
Qt-eff4c4b4172d1a95b1b5806622b4e7fe43c2b006.tar.bz2
Fix broken point item lookup in Graphics View.
Done with Andreas.
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index de6f5c4..7c46598 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -770,11 +770,22 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre
const QPointF &scenePos,
QWidget *widget) const
{
- Q_UNUSED(screenPos);
Q_Q(const QGraphicsScene);
QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0;
- return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder,
- view ? view->viewportTransform() : QTransform());
+ if (!view)
+ return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform());
+
+ const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
+ if (!view->isTransformed())
+ return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder);
+
+ const QTransform viewTransform = view->viewportTransform();
+ if (viewTransform.type() <= QTransform::TxScale) {
+ return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
+ Qt::AscendingOrder, viewTransform);
+ }
+ return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
+ Qt::AscendingOrder, viewTransform);
}
/*!