I almost have a completely working drag and drop re-order within a QTreeView. Everything seems to be ok except the dropped object never appears (though I can refer
This doesn't solve all the problems, but changing dropMimeData() to the following will at least allow moving leaf items.
self.beginInsertRows(parentIndex, row, row)
parentIndex.internalPointer().add_child_obj(Branch(item.get_name(), item.get_value(), parent), row)
self.endInsertRows()
A drag-drop operation is effectively two steps, an insert (done in dropMimeData) and a remove (done automatically by the Move drag operation). The changes above insert a new item rather than trying to insert an item which is already in the model and which will be removed from the old location after the insert occurs.