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

QtQuick Drag&Drop (Drag.automatic) regression: MouseRelease Event missing

    XMLWordPrintable

Details

    • macOS

    Description

      The example works as expected on 5.11.3 but fails to work with 5.12.0.

      Expected:

      • Press mouse on green rectangle
      • Dragged rectangle changes color to red (mouse pressed)
      • Either drop on yellow rectangle or release mouse (cancel drag)
      • Drag is finished/cancelled, rectangle green again (mouse released)

      With 5.12 no mouse release event is delivered in either the cancel or drop situation.

      Checked on macOS 11.14.1.

      import QtQuick 2.11
      import QtQuick.Window 2.11
      
      Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
      
        Rectangle {
          id: draggable
          width: 200
          height: 200
          color: mouse.pressed ? "red" : "green"
      
          Drag.active: mouse.drag.active
          Drag.supportedActions: Qt.MoveAction
          Drag.proposedAction: Qt.MoveAction
          Drag.mimeData: {
            "application/item" : true  // accept only internal mime-type
          }
          Drag.dragType: Drag.Automatic
        }
      
        MouseArea {
          id: mouse
          anchors.fill: parent
          drag.target: draggable
      
          onReleased: console.log("RELEASED")
        }
      
        Rectangle {
          x: 300
          y: 10
          width: 100
          height: 100
          color: "yellow"
      
          DropArea {
            id: dropArea
            anchors.fill: parent
            keys: ["application/item"] // accept only special internal drag
            onDropped: { console.log("DROPPED"); drop.accept(Qt.MoveAction); }
          }
        }
      }
      
      

      Attachments

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              njeisecke Nils Jeisecke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: