Synchronizing two different models



  • I have two different models subclassed from QAbstractItemModel, and views using a QTreeView, let call them A and B.

    Using Drag and Drop operations, I copy items from A to B. One of the properties I pass to B, is the QmodelIndex of A, in order to know where the Item came from and later make a link (item focus) of A while clicking in the copied Item in View B.

    This works when A is constant, but obviously if I add Items to A or sort the Tree, then the indexes change, and B will not work properly because it has the old indexes of A.

    I would like also to be able to save the Items data of B in a file, and later after loading this file be able to link to A. I can't save a QModelIndex

    Any idea of how can I achieve this?

    Thanks in advance


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.