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

HoverHandler.cursorShape doesn't change dynamically within same bounds

    XMLWordPrintable

Details

    • cd7c5f94a (dev), 4271d4586 (6.6), 66610bcb5 (tqtc/lts-6.5)

    Description

      It came up when I tried to use it in View3D to change the cursor when picking succeeds:

          View3D {
              id: view
      ...
              property var pickedModel: null
              HoverHandler {
                  onPointChanged: {
                      var result = view.pick(point.position.x, point.position.y);
                      view.pickedModel = result.objectHit;
                      console.log("pick dist", result.distance, "hit", result.objectHit,
                                  "scene pos", result.scenePosition, "uv", result.uvPosition, "->", view.pickedModel, cursorShape);
                  }
                  cursorShape: view.pickedModel == null ? Qt.SizeAllCursor : Qt.OpenHandCursor
              }
      

      but the scene fills the window and the mouse rarely leaves it (only when entering some other item on top). I used HoverHandler mainly for smaller items so far, so it was OK to have the cursor change only when entering or leaving the parent item.

      In QQuickWindowPrivate::updateCursor(), commenting out the "if" seems to fix it:

      // if (cursorItem != cursorItemAndHandler.first || cursorHandler != cursorItemAndHandler.second) {

      But maybe QQuickWindowPrivate::flushFrameSynchronousEvents() should directly look at items under each cursor's position, both to update hover state and to check the cursor shape to use. It might be nice to get away from sending events for that.

      Attachments

        1. hoverhandler-cursor-change.qml
          0.4 kB
          Shawn Rutledge
        2. test.qml
          0.9 kB
          Matthias Rauter

        Issue Links

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

          Activity

            People

              matthias_rauter Matthias Rauter
              srutledg Shawn Rutledge
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: