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

Drag and Drop with mimeData does not work properly on the touch screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.4, 5.13.0
    • None
    • Dell XPS 15 9560, Windows 10
    • Windows

    Description

      In the attached sample application (based on externaldraganddrop example):

      import QtQuick.Controls 2.4
      import QtQuick 2.12
      
      Rectangle {
          id: item
      
          property string display
      
          implicitWidth: 100
          implicitHeight: 100
          color: dropArea.containsDrag ? "#CFC" : "#EEE"
      
          ColorAnimation on color {
              id: rejectAnimation
      
              from: "#FCC"
              to: "#EEE"
              duration: 1000
          }
          Text {
              anchors.fill: parent
              text: item.display
              wrapMode: Text.WordWrap
          }
          DropArea {
              id: dropArea
              anchors.fill: parent
              keys: ["text/plain"]
              onDropped: if (drop.hasText) {
                  if (drop.proposedAction == Qt.MoveAction || drop.proposedAction == Qt.CopyAction) {
                      console.debug("DropArea onDropped", "proposed:", drop.proposedAction, "supported:", drop.supportedActions, "action:", drop.action)
                      item.display = drop.text
                      drop.acceptProposedAction()
                  }
              }
          }
          MouseArea {
              id: mouseArea
              anchors.fill: parent
              drag.target: draggable
          }
          Item {
              id: draggable
      
              anchors.fill: parent
              Drag.active: mouseArea.drag.active
              Drag.hotSpot.x: 0
              Drag.hotSpot.y: 0
              Drag.mimeData: { "text/plain": item.display }
              Drag.dragType: Drag.Automatic
              Drag.proposedAction: Qt.CopyAction
              Drag.supportedActions: Qt.CopyAction | Qt.MoveAction
              Drag.onDragStarted: {
                  console.debug("Drag.onDragStarted");
              }
              Drag.onDragFinished: {
                  console.debug("Drag.onDragFinished dropAction:", dropAction)
                  if (dropAction == Qt.MoveAction) item.display = ""
              }
          }
      }
      
      

      There are two problems:

      • If you drag text beetwen rectangles using touch on the touch screen, it happens that the drag does not work (hangs) until you move the mouse. This does not always occur but often. Certainly more than once in 10 times. Sometimes immediately. Additionally, you can see the warning: QML QQuickDragAttached: Binding loop detected for property "active". See the log for full view. Therefore, currently, unfortunately, it is not possible to stably drag mimeData using touch. The example does not use InputHandlers, which do not support DnD but MouseArea, where it should work with touch as well.
      • Additionally, Drag.proposedAction seems to be ignored in DropArea. As long as Drag.supportedActions contains Qt.MoveAction drop.proposedAction will be Qt.MoveAction and not Qt.CopyAction as Drag wants. I think this is not correct. This error has nothing to do with touch.

       

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              permotion88 Karol Polak
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: