Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73033

QGraphicsView::setTransformationAnchor(AnchorUnderMouse) does not work with wheelEvent when window is out of focus

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.6.3, 5.12.0, 6.5
    • Widgets: GraphicsView
    • None
    • macOS

      QGraphicsViewPrivate::lastMouseMoveScenePoint is updated inside: mouseMoveEventHandlercontextMenuEventmouseDoubleClickEventmousePressEventmouseReleaseEvent; but not inside: wheelEvent.

      Because mouseMoveEventHandler is not called when the window is out of focus (to update the mouse position), AnchorUnderMouse will not work to zoom in/out using wheelEvent (see #https://www.qtcentre.org/threads/52603-Zoom-effect-by-mouse-Wheel-in-QGraphicsview?p=264264#post264264).
      As consequence, zoom in/out with QGraphicsView::scale works perfectly as long as the application window has the focus. Once it is lost to another application, QGraphicsView will do it using lastMouseMoveScenePoint which was set before the window lost its focus. The user expects it to zoom in/out using the current mouse cursor as the center of the transformation, and not an almost random position.

      As a solution, updating lastMouseMoveScenePoint inside wheelEvent (as it happens with all other event handlers cited above) or scale, should be enough to fix this issue.

      This bug is related to QTBUG-60672

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ahi Adriel Jr.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes