Drag&Drop between Treeviews replaces target item
i use a dialogue window with 2 separate tree views. It is only possible to drag an item from the right tree to the left, no internal drag&drop either. In order to make drag&drop work, the functions
removeRowsare overwritten in the model, as well as
supportedDragActions, which is only allowing Qt::MoveAction.
Everything works fine, but when i drag an item from the right tree onto an folder in the left tree, the folder gets replaced by that item automatically.
This is not the intended outcome, i want to handle the insertion myself.
In my understanding, the functions
insertRowsare responsible for handling the way the dragged item is processed, but even ehen nothing happens in them, the target gets replaced.
I cant find the reason for this behaviour. In order to find it, i did overwrite
dropEventas well, but without calling dropMimeData, the functions
insertRowsare not called.
The problem is that I need those to determine which items were dragged and where. How can i find out what item is being dragged and where while preventing the target from being replaced?
thanks in advance
Hi and welcome to devnet,
What version of Qt are you using ?
On what OS ?
With what compiler ?
Can you provide a minimal compilable example that shows that behaviour ?