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

Drag and drop not working on MacOS when Drag.dragType is set to Automatic or None

    XMLWordPrintable

Details

    • macOS

    Description

      On MacOS for Qt 6.5.6, drag and drop is not working when the Drag.dragType is set to Drag.None or Drag.Automatic and Drag.startDrag() is called when Drag.active is true in Drag.onActiveChanged slot. The Drag dragStarted() and dragFinished() signals are being emitted at the same time while the drag is still active (DragHandler.active and Drag.active are both true). It seems the attached Drag.active binding is breaking.

      Example console output (Qt 6.5.6 and Drag.dragType: Drag.None):
      qml: 2024-08-01 13:24:14.726 DragHandler.onActiveChange active = true
      qml: 2024-08-01 13:24:14.726 Drag.onActiveChange begin active: true
      qml: 2024-08-01 13:24:14.727 Drag.onDragStarted
      qml: 2024-08-01 13:24:14.727 Drag.onDragFinished
      qml: 2024-08-01 13:24:14.727 Drag.onActiveChange begin active: false
      qml: 2024-08-01 13:24:14.727 Drag.onActiveChange active: false
      qml: 2024-08-01 13:24:14.727 Drag.onActiveChange active: false
      qml: 2024-08-01 13:24:16.781 DragHandler.onActiveChange active = false

      For Qt 6.7.2, drag and drop is not working correctly when the Drag.dragType is set to Drag.Automatic and Drag.startDrag() is called when Drag.active is true in Drag.onActiveChanged slot. After an item is dragged and dropped, the action is automatically reversed for the item. The Drag.dragStarted() signal is remitted after Drag.Active is false.

      Example console output (Qt 6.7.2 and dragType Automatic)
      qml: 2024-08-01 13:30:00.908 DragHandler.onActiveChange active = true
      qml: 2024-08-01 13:30:00.908 Drag.onActiveChange begin active: true
      qml: 2024-08-01 13:30:00.908 Drag.onDragStarted
      qml: DropArea onEntered
      qml: DropArea onEntered
      qml: DropArea onEntered
      qml: DropArea onDropped
      qml: 2024-08-01 13:30:02.694 Drag.onDragFinished
      qml: 2024-08-01 13:30:02.694 Drag.onActiveChange begin active: false
      qml: 2024-08-01 13:30:02.694 Drag.onActiveChange active: false
      qml: 2024-08-01 13:30:02.694 Drag.onActiveChange active: false
      qml: 2024-08-01 13:30:02.694 Drag.onDragStarted
      qml: 2024-08-01 13:30:02.723 DragHandler.onActiveChange active = false
      qrc:/qt/qml/draganddrop/views/gridview.qml:130:13: QML Icon (parent or ancestor of QQuickDragAttached): Binding loop detected for property "active"
      qml: DropArea onEntered
      qml: DropArea onDropped
      qml: 2024-08-01 13:30:03.535 Drag.onDragFinished
      qml: 2024-08-01 13:30:03.535 Drag.onActiveChange begin active: false
      qml: 2024-08-01 13:30:03.535 Drag.onActiveChange active: false

      To reproduce the issue, run the modified Drag and Drop example project for Qt 6.5.6 with dragType None and Automatic and for Qt 6.7.2 with dragType Automatic
      1. Set the Drag.dragType in views/Icon.qml line 54
      2. Start the application
      3. Select the GridView in the Launcher list
      4. Attempt to drag and drop an item

      Observed behavior (Qt 6.5.6): Item is dragged but not dropped on the receiving drop area and console log prints simultaneous calls to Drag.onDragStarted and Drag.onDragFinished after Drag.onActiveChanged with active true.

      Observed behavior (Qt 6.7.2): After item is dragged and dropped on the receiving drop area, the action is automatically reversed, and console log prints simultaneous calls to Drag.onDragStarted after Drag.onActiveChanged with active false is called.

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            lysandra.sola Lysandra Sola
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes