문제

Hi have a QListView created using QtDesigner and converted to python using pyuic4, and I imported the UI module where I am trying to connect it to events

for the QlistView i am trying to implement selection change when user presses up and down key, I am guessing the event should be fired when selection changes but that doesn't seems to do something

self.methodListView.selectionModel.selectionChanged.connect(self.outputHelp)

but this gives error

AttributeError: 'builtin_function_or_method' object has no attribute 'selectionChanged'

Do I need to add some more information to show exactly what I am doing?

도움이 되었습니까?

해결책

self.methodListView.selectionModel isn't an attribute, it's a function which returns the selection model. Just use

self.methodListView.selectionModel().selectionChanged.connect(self.outputHelp)

and it should work...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top