diff options
author | Jonathan Liu <net147@gmail.com> | 2012-02-23 13:42:34 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-28 14:35:06 (GMT) |
commit | 15c14584199dc43e4a309fc331f3144009008128 (patch) | |
tree | 73dcda7d6170e5e5b5fc699dac6880798db9d0f3 /src/gui/graphicsview | |
parent | 76225943555cf3540d137875c09e4e8db8fd33fb (diff) | |
download | Qt-15c14584199dc43e4a309fc331f3144009008128.zip Qt-15c14584199dc43e4a309fc331f3144009008128.tar.gz Qt-15c14584199dc43e4a309fc331f3144009008128.tar.bz2 |
Revert "Don't rely on mapFromGlobal in QGraphicsScenePrivate::itemsAtPosition."
This reverts commit 7c0d15a22266a425c9e9ac0120d6774e120fe01e.
The commit caused a regression whereby tooltips may be shown even if the
mouse is not over the item if it has the Qt::ItemIgnoresTransformations
flag and the QGraphicsView had been scaled.
Task-number: QTBUG-17517
Task-number: QTBUG-22663
Change-Id: Ib7fd788d9712c5e659fe07182f9505a4eb135ab2
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 14c0f3c..d1cdd4f 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1084,7 +1084,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 { @@ -1093,12 +1093,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); } |