diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-03-05 10:44:04 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-03-05 10:44:48 +0100 |
commit | d51abed57a8f677a0d4eac57fd3f16bd4662190a (patch) | |
tree | b3e173db4b72edbff6cb8dcc203c3d4526a1b51b /src/widgets/graphicsview/qgraphicsscene.cpp | |
parent | 07ae18f96e87a2db40ae014f28893f1080efa7ae (diff) | |
parent | 0862d7f78af978cf513097b3bdc33cd8096dee75 (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Change-Id: Ibcb1f7070f50968b77b66112750ce5c70fc0b6d0
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsscene.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 280aa7af8e..015cd254d4 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -1082,7 +1082,7 @@ void QGraphicsScenePrivate::enableMouseTrackingOnViews() /*! Returns all items for the screen position in \a event. */ -QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*screenPos*/, +QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos, const QPointF &scenePos, QWidget *widget) const { @@ -1091,12 +1091,16 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*sc if (!view) return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); - const QRectF pointRect(scenePos, QSizeF(1, 1)); + const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); if (!view->isTransformed()) return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); const QTransform viewTransform = view->viewportTransform(); - return q->items(pointRect, Qt::IntersectsItemShape, + if (viewTransform.type() <= QTransform::TxScale) { + return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, + Qt::DescendingOrder, viewTransform); + } + return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); } @@ -3114,12 +3118,12 @@ bool QGraphicsScene::stickyFocus() const the following events occur: \list - \o If the item receives a mouse release event when there are no other + \li If the item receives a mouse release event when there are no other buttons pressed, it loses the mouse grab. - \o If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}), + \li If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}), or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false)}), it loses the mouse grab. - \o If the item is removed from the scene, it loses the mouse grab. + \li If the item is removed from the scene, it loses the mouse grab. \endlist If the item loses its mouse grab, the scene will ignore all mouse events |