There are a lot of QML Drag and Drop Examples out there, but none of them really helps me, because in all the examples you can drag an element into another, where it is centered and all other elements you drag above are laying over it.
Is there a way to have some elements on one side and on the other side a big Rectangle
where you can drag them in, drop them anywhere inside of it and they stay on their exact drop position?
For example, if I got a Rectangle
with width: 200; height: 200
and I drag an element in, such an element should stay at the position I've dropped it, e.g. x: 25
and y: 65
. That should be the position of the element.
Do you have any suggestions?
It is very simple just to set
drag.target
to make anItem
draggable, as @qCring already noticed. Dropping the draggedItem
doesn't change its position at all. Anyway, maybe this small example can help you:Item
can be dragged into yellow box but not back. Made it just for fun.