From a3d2c4947e08bbb0ce11c252b576225f34a57e86 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Mon, 5 Oct 2026 09:44:30 +0200 Subject: [PATCH] Fix drag start: let startDrag() activate the automatic drag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The grip set dragProxy.Drag.active = true and then called startDrag(). For a Drag.Automatic drag that is wrong — startDrag() is what activates the drag — so it raised "startDrag() drag must be active", the OS drag never began, and every target showed the no-drop cursor. Remove the manual active assignment; call startDrag() alone (it runs the platform drag and blocks until it completes). Add Drag.proposedAction = MoveAction. Do the drag cleanup in onReleased via commitDrop(), which commits when the drop landed on a valid outline target and otherwise just clears the drag state. GUI builds clean. --- ui/qml/OutlineView.qml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 } }