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 slot.
Original line was:
self.connect(self.assetView.selectionModel(), SIGNAL(("currentRowChanged(QModelIndex,QModelIndex)")),self.assetChanged)
I’ve tried:
self.assetView.selectionModel.currentRowChanged(QModelIndex,QModelIndex).connect(self.assetChanged)
and I get: AttributeError: 'builtin_function_or_method' object has no attribute 'currentRowChanged'
self.assetView is a QTableView and self.assetChanged has def:
def assetChanged(self, index):
Grateful for any help
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
def assetChanged(self, current, previous):
print(current, previous)