diff --git a/ui/qml/OutlineView.qml b/ui/qml/OutlineView.qml index 794b208..6231374 100644 --- a/ui/qml/OutlineView.qml +++ b/ui/qml/OutlineView.qml @@ -572,9 +572,9 @@ ListView { Item { id: dragProxy anchors.fill: parent - Drag.active: false Drag.dragType: Drag.Automatic Drag.supportedActions: Qt.MoveAction + Drag.proposedAction: Qt.MoveAction Drag.keys: ["ork-section"] } @@ -591,22 +591,23 @@ ListView { if (started) return started = true // Record the drag source in the model (survives a - // later file switch) and begin the OS drag. + // later file switch) and begin the OS drag. For a + // Drag.Automatic drag, startDrag() activates it — + // do NOT set Drag.active manually first. docModel.beginDrag(del.index) outline.dragActive = true dragProxy.Drag.mimeData = { "text/plain": docModel.dragSourceDoc() + "\t" + docModel.dragSourceId() } - dragProxy.Drag.active = true dragProxy.Drag.startDrag() } onReleased: { - // If the drag never produced a drop, clean up. - if (outline.dragActive && !started) { - outline.dragActive = false - docModel.endDrag() - } + // startDrag() blocks until the OS drag finishes, so + // by here the drop (if any) has been handled by a + // DropArea. Clear any drag state that a drop didn't. + if (outline.dragActive) + outline.commitDrop() started = false } }