QListView SelectionModel selectionChanged Crash
In PySide I have the following MainWindow definition:
Code:
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
for i in range(10):
self.view.setModel(self.model)
self.view.selectionModel().selectionChanged.connect(self._selectionChanged)
self.setCentralWidget(self.view)
def _selectionChanged(self,selected, deselected):
pass
When I try and connect the selectionChanged signal I crash python. It's the same as this SO post and the workaround suggestion of keeping the selection model around seems to work.
Code:
self.viewselectionModel = self.view.selectionModel()
self.viewselectionModel.selectionChanged.connect(self._selectionChanged)
But is this safe? And is this an official bug in PySide? I could not find anything in the bug report database.
_chouqud_