diff options
Diffstat (limited to 'examples/quick/externaldraganddrop/DragAndDropTextItem.qml')
-rw-r--r-- | examples/quick/externaldraganddrop/DragAndDropTextItem.qml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml b/examples/quick/externaldraganddrop/DragAndDropTextItem.qml index 9858a961c9..605dc07434 100644 --- a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml +++ b/examples/quick/externaldraganddrop/DragAndDropTextItem.qml @@ -71,14 +71,18 @@ Rectangle { id: dropArea anchors.fill: parent keys: ["text/plain"] - onEntered: if (!acceptDropCB.checked) { - drag.accepted = false - rejectAnimation.start() + onEntered: (drag) => { + if (!acceptDropCB.checked) { + drag.accepted = false + rejectAnimation.start() + } } - onDropped: if (drop.hasText && acceptDropCB.checked) { - if (drop.proposedAction == Qt.MoveAction || drop.proposedAction == Qt.CopyAction) { - item.display = drop.text - drop.acceptProposedAction() + onDropped: (drop) => { + if (drop.hasText && acceptDropCB.checked) { + if (drop.proposedAction == Qt.MoveAction || drop.proposedAction == Qt.CopyAction) { + item.display = drop.text + drop.acceptProposedAction() + } } } } @@ -95,7 +99,10 @@ Rectangle { Drag.hotSpot.y: 0 Drag.mimeData: { "text/plain": item.display } Drag.dragType: Drag.Automatic - Drag.onDragFinished: if (dropAction == Qt.MoveAction) item.display = "" + Drag.onDragFinished: (dropAction) => { + if (dropAction == Qt.MoveAction) + item.display = "" + } } Examples.CheckBox { id: acceptDropCB |