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

QGuiApplication should update lastCursorPosition on both Enter and Leave events

XMLWordPrintable

      We want Qt Quick to be able to rely on QGuiApplicationPrivate::lastCursorPosition for now (and later maybe we can move it to QPointingDevice, to be able to support multiple mice and other pointing devices that can control cursors).

      QGuiApplicationPrivate::processEnterEvent() was not doing that. So I added it in https://codereview.qt-project.org/c/qt/qtbase/+/684038

      Then I noticed if I run qtdeclarative/examples/quick/pointerhandlers/sidebar.qml, put the cursor at the right side of the window where the animating "paddle" rectangle will sometimes be hovered, then jerk the mouse to the right, it leaves the window and lastCursorPosition does not get reset! So it will keep getting hovered as if the mouse was still there.

      So presumably we need to be symmetric about this: lastCursorPosition will only be valid as long as the mouse is within one of the application's windows, and I suppose we'll have to call QLastCursorPosition::reset() again to send it offscreen when it leaves. Qt can't expect to track the mouse when it's outside any of the application's windows (and even less so over time, since global mouse tracking would nowadays be seen as security risk on multiple platforms).

        For Gerrit Dashboard: QTBUG-141387
        # Subject Branch Project Status CR V

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change