0

I wanted to know how I could associate a key with an entry to the QstandardItemModel. This would help me retrieve the row of the entry.

MistyD
  • 16,373
  • 40
  • 138
  • 240

1 Answers1

0

http://doc-snapshot.qt-project.org/4.8/qstandarditemmodel.html#details

All the accessor methods to data use:

http://doc-snapshot.qt-project.org/4.8/qmodelindex.html

QModelIndex

http://doc-snapshot.qt-project.org/4.8/model-view-programming.html#model-indexes

http://doc-snapshot.qt-project.org/4.8/qpersistentmodelindex.html

The QPersistentModelIndex class is used to locate data in a data model.

A QPersistentModelIndex is a model index that can be stored by an application, and later used to access information in a model. Unlike the QModelIndex class, it is safe to store a QPersistentModelIndex since the model will ensure that references to items will continue to be valid as long as they can be accessed by the model.

It is good practice to check that persistent model indexes are valid before using them.

Hope that helps.

Community
  • 1
  • 1
phyatt
  • 18,472
  • 5
  • 61
  • 80