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

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.6.3, 5.12.0
    • Fix Version/s: None
    • Component/s: Widgets: GraphicsView
    • Labels:
      None
    • Platform/s:
      macOS

      Description

      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

        Attachments

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

          Activity

            People

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

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes