How to keep a pointer to a QAbstractItemModel cell which its index changes?



  • We have a QAbstractItemModel which we dynamically insert rows in it. We want to keep a pointer to every newly added rows in order to be able to change its color later. QModelIndex cannot be used, because it just points at the location specified by rows and columns, and since the model is dynamically updated, it's not the same cell the next time. How can we save a pionter to a specific cell (regardless of its row and column)?



  • Hm, maybe a QPersistentModelIndex would do the trick?



  • Thank you. it did the trick.


Log in to reply
 

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