Clean up selection model properly in completion.

http://qt-project.org/doc/qt-5/qabstractitemview.html#setModel :

This function will create and set a new selection model, replacing any model
that was previously set with setSelectionModel(). However, the old selection
model will not be deleted as it may be shared between several views. We
recommend that you delete the old selection model if it is no longer required.
This commit is contained in:
Florian Bruhin 2014-10-08 17:36:59 +02:00
parent de86a26473
commit fe1215c74d

View File

@ -190,7 +190,10 @@ class CompletionView(QTreeView):
Args:
model: The model to use.
"""
sel_model = self.selectionModel()
self.setModel(model)
if sel_model is not None:
sel_model.deleteLater()
self.expandAll()
self._resize_columns()
model.rowsRemoved.connect(self.maybe_resize_completion)