PDA

View Full Version : How do I save QStandardItemModel's checkState



lni
2nd May 2012, 23:56
Hello, I need to save QStandardItemModel, which is fine. But I also need to save each item's checkState of the model separately. How can I do that? I am getting QModelIndex of each item, but the QModelIndex is related to its parent, for instance, in the attachment, item11 and item21 have same index.row() and index.column(). The QModelIndex::internalPointer() can't really be used when saving to a file...

Help is very much appreciated!

Le_B
3rd May 2012, 02:37
save the check state separately ? you mean in a different file ?
in a seperate file i would save the full path of the item (until !index.parent().isValid()) separate by '|' for exemple so that you can recreate it easily.

lni
3rd May 2012, 11:49
save the check state separately ? you mean in a different file ?
in a seperate file i would save the full path of the item (until !index.parent().isValid()) separate by '|' for exemple so that you can recreate it easily.

Many thanks!