I need a Unique Index in QTreeView or something like that

  • Im building a QTreeView with a QAbstractItemModel. And because i want to use a Database for the TreeView im interested in how the index in the TreeView works. I found out that every parent has childs and every child has a row, but is there a Index or something or a Unique ID? I want to append a child to a parent that i get from a Database. It would be easy if i have a Database with 2 Columsn. 1 Column the Parent (ID or Index or something) and 1 Column for the Name. The Problem is that if i add a new Entry in the Database i need to jump to the parent at the end of a Loop, if i build a Model. You now what i mean? Is there a Possibility to jump to an parent or an child at the end of a Loop?

  • Moderators

    do you mean something like QModelIndex::parent() ??

  • A QModelIndex has a row, column and a parent right? Can i save it to a Database?

Log in to reply

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