Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Avoid QTreeWidgetItem to have children
excalibur1491 last edited by
I have been working with QTreeWidget and QTreeWidgetItem and I have had some problems to be able to drag&drop QTreeWidgetITems form a QTreeWidget to another. Anyway I found a way to do it by reimplementing the dropEvent.
Now, I still have a problem... This is my current situation:
I have a class Item which inherits form QTreeWidgetItem and a class TWidget wich inherits from QTreeWidget (with its dropEvent method reimplemented, as I said above).
What I want is to be able to drag&drop items into other items (to create "groups"), but not for all the items. I have a boolean property in my Item class that says "if true, I can be a group, if false, I can't". So I want to be able to drag and drop Items into other Items only if this boolean is set to true for the target.
The best information I have found yet is this: http://www.qtcentre.org/threads/5910-QTreeWidget-Drag-and-drop , but does not help me much because I don't have any idea how to reimplement dropMimeData.. I don't even understand wha this method does from reading the documentation.