How do I perform simple drag and drop?
-
I'm trying to drag and drop one square to another, using this code:
@//where I want to drag from
Connector {
id: connector
anchors.right: parent.right
MouseArea {
id:dragArea
anchors.fill: parent
drag.target: dragDummy
onReleased: {
console.log("Released");
}
Rectangle{
id:dragDummy
color:'pink'
width:radius2
height:radius2
radius: 4
}
}
}@@//where i want to drop something
Connector {
id: connector
anchors.left: parent.left
DropArea{
anchors.fill: parent
Rectangle{
anchors.fill: parent
color: "blue"
}
onDropped: {
console.log("Dropped");
}
}
}@I can see the pink circle moving when i drag it, but "Dropped" is never printed when I release it in the blue area.
What am I missing?
-
compare your code with Qt example.
QTPATH\examples\quick\draganddrop