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

DragHandler not stable on touch screen

XMLWordPrintable

    • Windows

      This code does not work properly:

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
      
          Rectangle {
              anchors.centerIn: parent
              width: 640
              height: 80
              color: "yellow"
      
              Rectangle {
                  id: feedback
                  color: "red"
                  width: 100
                  height: 100
                  radius: Math.max(width, height) / 2
                  visible: handler.active
              }
      
              DragHandler {
                  id: handler
                  target: feedback
                  dragThreshold: 10 //try with: 0 10 30 50 100
                  minimumPointCount: 1
                  maximumPointCount: 1
                  grabPermissions: PointerHandler.CanTakeOverFromAnything
                  onGrabChanged: {
                      console.debug("onGrabChanged", transition, point, point.state, dragThreshold);
                  }
                  onCanceled: {
                      console.debug("onCanceled", point, point.state, dragThreshold);
                  }
                  onActiveChanged: {
                      console.debug("onActiveChanged", active)
                  }
              }
          }
      }
      

      if the application is used on a touch screen. 

      There are two problems there:

      • very often DragHandler activation does not occur
      • if activation occurs the target is not in the middle under the finger, as it is with the mouse cursor

      I noticed that the problem worsens if dragThreshold is larger (with default 10 for my system) the problem occurs quite often. For larger values almost always. However, it also happens for 0.

      The sample code works without problems with all values with Qt 5.15.2 for both mouse and touch. So this is a regression.

        1. demo.mp4
          326 kB
        2. DragHandlerOnTouchProblem.7z
          1 kB
        3. feedback.qml
          2 kB
        4. feedback-add-patch.mp4
          111 kB
        5. feedback-no-patch.mp4
          121 kB
        6. TouchScreen-feedback-add-patch.mkv
          203 kB
        7. TouchScreen-feedback-no-patch.mkv
          207 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            permotion88 Karol Polak
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes