Lifetime of QStandardItem objects from QStandardItemModel



  • Does anyone know when QStandardItem objects/pointers from QStandardItemModel methods like item() and itemFromIndex() should no longer be considered valid? I mean, I'm assuming they will be gone if the rows/columns in question are removed, but can they also be invalidated on other events, like when data items are inserted or removed elsewhere in the model?

    And how about the objects passed to insertRow() or similar. It looks like these will initially used directly (data is not copied), but for how long are they kept?



  • As long as the item is in the view (doesn't matter if it is moved around)

    EDIT: I meant model (not view)



  • And what if there isn't a view?

    I have a setup where a certain model and its data always exists througout the lifetime of the application, but the view into it may be freely opened and closed by the user.



  • I mean model not view


Log in to reply
 

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