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

Add option to prevent "Drag without press" behavior

    XMLWordPrintable

Details

    • All

    Description

      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.

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes