I somehow clicked on the wrong section. Could someone please move this thread to qt Programming?
I somehow clicked on the wrong section. Could someone please move this thread to qt Programming?
I suggest you let your second thread aggregate the data in some struct and, once finished, update your model in one go using that struct. That way you avoid both the view accessing a partially updated model and have just one "update".
Also note that the model must only be updated from the gui thread.
As you may think that's surely something I thought about earlier and it's a very complicated go. I will have a look again but I hoped for different solutions.I suggest you let your second thread aggregate the data in some struct and, once finished, update your model in one go using that struct. That way you avoid both the view accessing a partially updated model and have just one "update".
I know the implementation works but most times it crashes because of the written reason.Also note that the model must only be updated from the gui thread.
You should use the concept of snapshots - snapshot (copy) the current data at the same time blocking user changes to the model (if applicable), rearrange the copied model data in the other thread and when you're done, attach the data back to the main root of the model.
Bookmarks