I'm confused about what the correct way to reset or clear the data in associated with a
I'm writing an application in which the user can "start over" with a new set of data (empty, or small).
Should I be deleting the old model when the user makes this request? Or should I leave the model alone and just remove all of the rows?
Regards, Dan O
Generally I would prefer to have the model react to changes and take the necessary actions to update it's view (indirectly ofcourse). However, programming models can be (=is) a PITA, so I would probably look through the fingers if I was reviewing code that created a new model and deleted the old one. Only do this if you are sure the user only will delete all rows. If the user may delete items from the model incrementally you're probably best off implementing removal properly in the first place...
Also, ModelTest might help you discover problems with your Qt models.
If the user is truly starting over with a new set of data, then it makes sense to me to simply delete the old model and create a new one. Simple, effective, and it matches up to what the user is doing.