<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt">I'd probably be using something like libQxt's RPC's functionality to publish updates to you and incrementally adjust the model, a row at a time. http://libqxt.bitbucket.org/doc/tip/qxtxmlrpcclient.html<br><br><br><div><span><br></span></div><div><br></div>  <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Stephen Chu <stephen@ju-ju.com><br> <b><span style="font-weight: bold;">To:</span></b> Interest@qt-project.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, August 22, 2012 2:29 PM<br> <b><span style="font-weight: bold;">Subject:</span></b>
 [Interest] Proper way of updating a model?<br> </font> </div> <br>
Thanks to everyone who helped on the 64-bit internal ID question I <br>posted. I end up maintaining a copy of index-and-id mapping to work <br>around it.<br><br>Now I have a question on how to properly update the model. My model is a <br>read-only representation of a database. I am using a QTreeView to hold <br>the model. The data themselves are not tree-like but I like the visual <br>of QTreeView better.<br><br>The model needs to update itself periodically from the remote database. <br>I keep a QList of data IDs and rebuild the list every time I get a new <br>snapshot from the database.<br><br>What's the recommended way to reflect the changes to the view? I need to <br>keep the current selection and scroll position of the QTreeView between <br>updates.<br><br>Do I reset the model? Or do I remove deleted rows and insert new ones?<br><br>Thanks.<br>_______________________________________________<br>Interest mailing list<br><a
 ymailto="mailto:Interest@qt-project.org" href="mailto:Interest@qt-project.org">Interest@qt-project.org</a><br>http://lists.qt-project.org/mailman/listinfo/interest<br><br><br> </div> </div>  </div></body></html>