In the qml documentation there is a drag'n'drop example:
import QtQuick 2.0
Item {
width: 200; height: 200
DropArea {
x: 75; y: 75
width: 50; height: 50
onDropped: console.log("dropped")
onEntered: console.log("entered")
Rectangle {
anchors.fill: parent
color: "green"
visible: parent.containsDrag
}
}
Rectangle {
x: 10; y: 10
width: 20; height: 20
color: "red"
Drag.active: dragArea.drag.active
Drag.hotSpot.x: 10
Drag.hotSpot.y: 10
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}
I have added the two lines with "onDropped" and "onEntered". While "onEntered" is triggered by dragging the small rectangle, I can not make the "onDropped" to trigger.
What do I have to do to make it trigger?