View Full Version : How do I signal from the model that a full refresh is required?

29th July 2014, 20:27
After applying a sorting algorithm to my model data, I want to signal the QtTableView that an update is required. I tried using beginResetModel\endResetModel, but that clears the selection state. How do I signal a refresh without losing the active table selection?


Aaron Stibich

29th July 2014, 22:33
How do you expect a view to retain the selection if you want to inform it that the whole model is invalidated? There are two ways to retain the selection -- either use moveRows functionality to inform the view about exact changes in the order of elements or save the selection using some external means (e.g. by saving some list of identifiers for each row selected) and then restore the selection based on that information after the model is reset.