QTreeWidget with selective InternalMove
I'd like to create a QTreeViewWidget to show virtual folders and data items which would allow intern moves (QAbstractItemView::InternalMove), so that the user could drag the folders and data items between the folders freely.
However, with the default behaviour if I enable InternalMove, dragging a data1 item over another data2 item will make the data2 item act as a folder (with data1 becoming a child of data2), where it shouldn't. Only folder can embbed folder and data items.
So it should be very similar to a Folder/File system, but I have no idea how to tell Qt that my data items cannot accept sub items.
How can I do that ?
You could override
and only flag some for Qt::ItemIsDropEnabled
So when a "file" it will not accept other file dropped to it.
Thanks, would it still allow the data items to be reorganized?
Moved up/down within the same folder, for example?
I think it would. It would only forbid to
drop directly on an other item.
Its pr item flag. Liek to allow edit only some etc.
disclaimer: I never tried it, with your use case.