Skip to content Skip to sidebar Skip to footer

Pyqt5 Converting Signal Code From Pyqt4

I'm a newbie and am having difficulty changing a line of code from PyQT4 to PyQT5, its to do with signals & slots. I suspect its because arguments are being passed to the slo

Solution 1:

The new syntax is as follows:

sender.signal.connect(some_slot)

In your case:

self.assetView.selectionModel().currentRowChanged.connect(self.assetChanged)

#   ^^^^^^^^^sender^^^^^^^^       ^^^^signal^^^^            ^^^^^^slot^^^^^^

and

defassetChanged(self, current, previous):
    print(current, previous)

Post a Comment for "Pyqt5 Converting Signal Code From Pyqt4"