I am developing a QML application which basically contains two ListView. I would like to copy a QML item from one ListView to another. I tried to handle this by setting Drag property in the delegate but the item cannot go outside the view when I drag the item, I think the Flickable container handles mouse events.
So, I want to try the following:
- create a mousearea which overlaps the to ListView
- create a new object by calling **createComponent() / createObject()**
- reparent this object to the mousearea
- handle mouse events in the mousearea till drop
This solution seems to me a little complicated, so do you have a better way to achieve this ?
This was a bad idea and too much complicated. I think I got a way to achieve this:
- each delegate of the ListView has a hidden Item which can be dragged,
- as my ListView are in a reusable component, I use a property to pass a higher item (a Rectangle here and NOT a **MouseArea**) which can be used as parent for dragged items,
- the higher item contains the two ListView (and maybe more in the future),
- when the drag begins, the item is set to visible and reparented using a **State**
So, I missed the point that set the parent should solve my problem.