Drag&Drop between Treeviews replaces target item
-
Hi,
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 functionsdropMimeData
,insertRows
andremoveRows
are overwritten in the model, as well assupportedDragActions
, 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 functionsremoveRows
andinsertRows
are 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 overwritedropEvent
as well, but without calling dropMimeData, the functionsremoveRows
andinsertRows
are 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
Jonathan -
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 ?