It seems that when dropping and dragging within a QTreeView, the natural order is to insert the moved node under it's new parent node first (using beingInsertRows() and endInsertRows() )
and then Qt automatically calls your model's implementation of removeRows() to remove the node from its previous parent node (using beginRemoveRows() and endRemoveRows() ).
It is also possible to not implement removeRows() in your model but rather create another method that you call manually to remove the row (still using beginRemoveRows() and endRemoveRows() ).
Either of these methods becomes problematic for me because my underlying datastructure can only have one of the same node object in it at one time. Therefore I can't insert the same node in a new position and remove it from the old position in my datastructure..
What would be easier for me is to remove the dragged node first and then reinsert it into the datastructure.
Before I go to the trouble of implementing this, does anyone know if Qt has a problem with removing the dragged row first and then inserting it rather than the other way around.
Thanks
Jeff
Bookmarks