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

Add option to prevent "Drag without press" behavior

XMLWordPrintable

    • All

      Currently, an enabled drag handler will start drag if

      1. it is enabled
      2. the delta of input coordinates exceeded the dragTreshold

      This can lead to unintended drag operations if the DragHandler is enabled while an input device is already in "pressed/down" state. In this case, the DragHandler never received a "press" in enabled state, still it starts the drag operation. In many use cases, this is surprising to the user.

      There are workarounds (e.g. use a MouseArea to enable/disable the drag handler on press/release, or a corresponding component for the type of input device you need), but they add some complexity for what I would consider the "more common" use case (something you could argue about, I know).

      Since behavior has to remain compatible, the default behavior cannot easily be changed, anyway. Therefore I would suggest a property e.g. "startDragOnPressOnly" or similar.

      I have attached a little test project. The drag handler is enabled 2s after application start. If you press-and-hold the input device before that, and wait for the 2s to expire, you can start dragging without pressing anything.

       

        1. qt_test_qml_draghandler.zip
          2 kB
          Robert Schimkowitsch
        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
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes