But if you think about the idea of using a 2-way map between QStandardItem and QGraphicsItem, the synchronization problem is resolved pretty easily. When the user selects items from the tree, you retrieve the list of selected QStandardItems, look them up in the map, and set the matching QGraphicsItem to selected. Likewise, when the user selects items in the graphics view, you do the reverse lookup and set the QStandardItem as selected.
Exactly. The solution I came up with is a templated bi-directional hash map:
Qt Code:
  1. template <class U, class V>
  2. class BidirectionalHashMap
  3. {
  4. public:
  5. U find(V v) { return mapVU.find(v).value(); }
  6. V find(U u) { return mapUV.find(u).value(); }
  7. void insert(U u, V v) { mapUV.insert(u,v); mapVU.insert(v,u); }
  8.  
  9. private:
  10. QHash<U, V> mapUV;
  11. QHash<V, U> mapVU;
  12. };
To copy to clipboard, switch view to plain text mode 

It works great for what I needed to accomplish.