I have one DropArea
and two elements. I want DropArea
reject the drop event if the DropArea
already got one element be dropped, the another element not allow drop into, unless the first one move out.
DropArea {
property bool dropped: false
onDropped: {
drop.accepted = !dropped;
dropped = true;
}
onExited: dropped = false
}
But looks like drop.accepted
not work,
BTW anyway to get the objects was dropped in DropArea
Use
drop.accept()
instead. The above can be done as follows:Also donot use
dropped
property as it is already an attached property insideonDropped
event handler.Edit: If
rect
is the Item to be dragged and dropped then:You should control if the item must be dropped or not in
onReleased
, checking thedropped
property.Full example: