'PySide.QtCore.Signal' object has no attribute 'connect'
In addition to ekhumoro's answer, the class with the signal also needs to call super().__init__()
. Forgetting to do so can lead to the same error.
class Model(QtCore.QObject):
updateProgress = Signal(int)
def __init__(self):
super().__init__() # This is required!
# Other initialization...
The signal must be defined on the class, not the instance. The class must be a subclass of QObject
, or be a mixin of such a class. So either of:
class Model(QtCore.QObject):
updateProgress = Signal(int)
or:
class Mixin(object):
updateProgress = Signal(int)
class Model(Mixin, QtCore.QObject):
pass