I'd like to use a QTreeView to display/edit a directed acyclic graph (a tree where a node may have more than one parent). For example, the following tree has node2 used in 2 different places:
Qt Code:
  1. Root
  2. parentA
  3. node1
  4. node2
  5. parentB
  6. node2
  7. node3
To copy to clipboard, switch view to plain text mode 

The only challenge is implementing the "parent()" method. At the moment there is no way to know the path that was taken to get to a node so that the proper parent can be returned based upon how the node was reached. At the moment, I am thinking of sub-classing QModelIndex (ugh) to extend it with the full path to the object.

Has anyone else done anything like this? How did you do it?