python - PySide: Segfault(?) when using QItemSelectionModel with QListView -


same exact problem this: connecting qtableview selectionchanged signal produces segfault pyqt

i have qlistview, , want call function when item selected:

self.server_list = qtgui.qlistview(self.main_widget) self.server_list_model = qtgui.qstandarditemmodel() self.server_list.setmodel(self.server_list_model) self.server_list.selectionmodel().selectionchanged.connect(self.server_changed) 

but, when reaches last line, i'm using selection model, app crashes. not traceback, "appname has stopped working" windows. i'm pretty sure that's segfault.

but, when use pyqt4 works fine. i'm using pyside because it's lgpl.

yes, i'm on latest versions of (pyside: 1.2.1, python 2.7.5, qt 4.8.5).

can me this?

try holding reference selection model lifetime of selection model. worked me similar problem (seg fault when connecting currentchanged event on table views selection model).

self.server_list = qtgui.qlistview(self.main_widget) self.server_list_model = qtgui.qstandarditemmodel() self.server_list.setmodel(self.server_list_model) self.server_list_selection_model = self.server_list.selectionmodel() # workaround self.server_list_selection_model.selectionchanged.connect(self.server_changed) 

for reason, last 2 lines work, while combining them 1 command throws error.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -