[Interest] Proper way of updating a model?
stephen at ju-ju.com
Wed Aug 22 20:29:48 CEST 2012
Thanks to everyone who helped on the 64-bit internal ID question I
posted. I end up maintaining a copy of index-and-id mapping to work
Now I have a question on how to properly update the model. My model is a
read-only representation of a database. I am using a QTreeView to hold
the model. The data themselves are not tree-like but I like the visual
of QTreeView better.
The model needs to update itself periodically from the remote database.
I keep a QList of data IDs and rebuild the list every time I get a new
snapshot from the database.
What's the recommended way to reflect the changes to the view? I need to
keep the current selection and scroll position of the QTreeView between
Do I reset the model? Or do I remove deleted rows and insert new ones?
More information about the Interest