Is it possible to have more than one Drag.hotspot??
-
My program have several items from the same component as below
The items that create from the component will need to be dragged and dropped on each other
The goal is to achieve the effect like you can drag a file on a folder in Windows and drop it on the folder then something happenRectangle { id: box Drag.active: mouseArea.drag.active Drag.hotSpot.x: width /2 Drag.hotSpot.y: height / 2 MouseArea { id: mouseArea anchors.fill: box drag.target: box } DropArea { id: dropArea anchors.fill: box } }
So as you can see I set my hot spot in the center like everyone, which works ok when every items are in similar size
But if one item is much shorter than the other one , when you drag the longer one on the shorter one, to move the hotspot in the center into the shorter item's dropArea become very weird, you will see very big part of the longer item is over the shorter one already but the effect on the dropArea still not triggered.
I think if I can add more hotspot and put it in the different spots in the item so it can be detected by the target's dropArea earlier.
But I found it is impossible
I have tried adding two box above and below the main box and give themDrag.active: mouseArea.drag.active Drag.hotSpot.x: width /2 Drag.hotSpot.y: height / 2
but it did not work,
How do you guys fix this type of problem?The other thing is I saw many example set the hotspot in the center and the dropArea cover it, they dont seems to have problem the drag event from the item itself is detected by it's own dropArea which is unwanted behavior.
I fix it by adding keys but I didn't see they do this in the example but their code seems to work just fine?Thanks you for the comment