This is refactoring the code, it is doing the same as before.
QTableView already manages its own selectionModel based on the model
we give it there does not seem to be a reason why we would duplicate thise code
- simplify the code managing the models by removing the manual selectionModel
management and instead letting Qt handle its creation via QTableView::setModel
- update the deletion comment to point out that deleting the old model will in
fact also delete the associated automatically created selectionModel
- move behavior and mode setup of the view to the constructor. a search
on the QAbstractItemView suggests that neither setting is passed along
nor mutated outside the setter, so we only need to set these up once
ideally I suppose instead of changing the model at all we should have a
full model and put a qsortfilterproxymodel in front of it thus making
setContents in its current form obsolete as we'd then only need to filter
as necessary. I am not quite confident enough in my understanding of
how the code presently works to make such an invasive change.