Connecting QTableView selectionChanged signal produces segfault with PyQt

与世无争的帅哥 提交于 2019-12-01 03:59:46
eric

I was having a similar problem and the fix was here: PySide: Segfault(?) when using QItemSelectionModel with QListView

Namely, replace:

self.view.selectionModel().selectionChanged.connect(self.selChanged)

with two commands:

selectionModel = self.view.selectionModel()
selectionModel.selectionChanged.connect(self.selChanged)

Not sure why this works, frankly.

This has been fixed now, it turned out that I was using an old version of Qt on that machine - which seemed to cause the crash.

The moral of the story is: if your code is crashing for no sensible reason, check all of your dependencies (in this case Qt and PyQt) are up-to-date.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!