This is a minimal test about how to do drap-and-drop within a QTreeWidget.
First let the tree setAcceptDrops. Then declare mouseMoveEvent, dropEvent, dragEnterEvent, and let dragMoveEvent = dragEnterEvent. The rest is to set mimeData, by which the information can be transferred between those events. Here only a string, name of the item, will be sent.
Click LMB on an item, drag-and-drop onto another, a new item will be created and attached to the latter. The drop event must hit an item.