diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-17 11:29:09 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-17 11:39:47 (GMT) |
commit | abdf1befb8de4b88da43561dae2e1beb09c2a532 (patch) | |
tree | 5980f79a54bd1b8f1b2b650381c4b38a25e3390d /src/gui/graphicsview/qgraphicsview.cpp | |
parent | 9b4982af65e533b0613abd0f889bcf6e7673e410 (diff) | |
download | Qt-abdf1befb8de4b88da43561dae2e1beb09c2a532.zip Qt-abdf1befb8de4b88da43561dae2e1beb09c2a532.tar.gz Qt-abdf1befb8de4b88da43561dae2e1beb09c2a532.tar.bz2 |
Transforms do not obey AnchorUnderMouse with viewport margins set
setTransformationAnchor(QGraphicsView::AnchorUnderMouse) would not work
properly if viewport margins were set. When centering the view in
QGraphicsViewPrivate::centerView, the viewport margins were not being taken
into account.
Mapping from global cursor coordinates in the viewport instead of the view
fixes the issue.
Task-number: 255529
Reviewed-by: Olivier
Diffstat (limited to 'src/gui/graphicsview/qgraphicsview.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 7213542..91e654c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -493,8 +493,8 @@ void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor) // Last scene pos: lastMouseMoveScenePoint // Current mouse pos: QPointF transformationDiff = q->mapToScene(viewport->rect().center()) - - q->mapToScene(q->mapFromGlobal(QCursor::pos())); - q->centerOn(lastMouseMoveScenePoint + transformationDiff);; + - q->mapToScene(viewport->mapFromGlobal(QCursor::pos())); + q->centerOn(lastMouseMoveScenePoint + transformationDiff); } else { q->centerOn(lastCenterPoint); } |