Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Synchronizing two different models

Synchronizing two different models

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 508 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joorge87
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved