Drop Area rejects drag sometimes, which results DropArea to break
-
I have observed an issue with DropArea. Here what I am doing is to drag and drop small rectangles onto a DropArea. After consecutive drag drop operations, DropArea rejects the drag. Then after that DropArea doesnt accept any drag, and it remains inactive. I have to close my application to make it work again.
I have found a related bug: https://bugreports.qt.io/browse/QTBUG-39453
Is there any workaround to fix it?
I dont know why the DropArea is rejecting the drag for the first time which results the failure.
Following is the codeRectangle { id: dragRect width: 500 height: 200 MouseArea { id: mouseArea anchors.fill: parent drag.target: dragRect drag.onActiveChanged: { if (mouseArea.drag.active) { // do something at drag start } var dragResult = dragRect.Drag.drop(); if(dragResult === Qt.IgnoreAction) { if(!mouseArea.drag.active) { console.log("Drop ignored. Item must be restored."); } } } } Drag.active: mouseArea.drag.active Drag.hotSpot.x: dragRect.width / 2 Drag.hotSpot.y: dragRect.height / 2 } Rectangle{ id: mainViewArea objectName: "mainViewArea" width: parent.width height: parent.height color: Qt.lighter(outerViewArea.color, 1.25) // The entire view are must be a target for drag and drop operations DropArea { id: dragTarget property string colorKey property alias dropProxy: dragTarget width: parent.width height: parent.height onDropped: { drop.visible = false drop.acceptProposedAction() console.log("dropped") } Rectangle { id: dropRectangle anchors.fill: parent states: [ State { when: dragTarget.containsDrag PropertyChanges { target: dropRectangle color: Qt.darker(mainViewArea.color, 1.25) } } ] } }
Ignore any bracket closing issue found
Edit - Please follow Markdown syntax rules - p3c0