In a QTreeWidget I want to be able to reorder items using InternalMove AND receive drops from another tree in my application.
If I set dragDropMode
to InternalMove
I cannot drop items inside it. However, if I set it to DragDrop
it lets the user drag items out of the my QTreeWidget.
Is there a way of preventing this? Is there another way around the problem?
If you are not worried about drags outside of your application, maybe setting the DragDropMode
of the other QTreeWidget
in your application (or anything that derives from QAbstractItemView
for that matter) to:
treeWidget->setDragDropMode(QAbstractItemView::DragOnly);
is enough to get the desired behavior. This does not prevent the items of the QTreeWidget
in question from being dragged, but they cannot be dropped in the other tree, while you can still drop them (and the items from the DragOnly tree) into the tree that accepts drops. Does this help? (Admittedly not the most intricate way to attack the problem but performing some local tests it seemed to work)