[PyQt] Connecting to base class signals in subclass

Demetrius Cassidy dcassidy36 at mass.rr.com
Fri Mar 19 23:45:25 GMT 2010


I am not sure if this is the intended behavior, but if I subclass a QWidget
instance, and then try to connect to one of those signals in my subclass, I
get a TypeError:

>>> class MyLabel(QtGui.QLabel):
...     def __init__(self):
...             self.linkActivated.connect(self._lnkActivated)
...
...     def _lnkActivated(self, link):
...             pass
...
>>> l = MyLabel()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
TypeError: pyqtSignal must be bound to a QObject, not 'MyLabel'
>>>

Why can't I connect to my base class's signals in my subclass? 
-- 
View this message in context: http://old.nabble.com/Connecting-to-base-class-signals-in-subclass-tp27951038p27951038.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list