Question

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?

Was it helpful?

Solution

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...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top