[PyQt] [PyQt 4.5] TypeError: pyqtBoundSignal cannot be converted to QObject in this context

Phil Thompson phil at riverbankcomputing.com
Fri Apr 10 09:40:27 BST 2009


On Fri, 10 Apr 2009 12:06:37 +0700, Alexandr N Zamaraev <tonal at promsoft.ru>
wrote:
> Phil Thompson wrote:
>>>    def __connectAll(self):
>>>      for dm in (self.__phys, self.__jur, self.__bus):
>>>        dm.data_adds.connect(self.data_adds.emit)
>> 
>> I don't understand what you are trying to do in the last line.
> It may well be more intuitive:
> [code]
> class DataLink(QtCore.QObject):
>    data_adds = QtCore.QtCore.pyqtSignal(frozenset)
> ...
>    def addObjects(self, objs):
>      obj_oids = self._internalAddObjects(objs, *args, **kwd)
>      self.data_adds.emit(obj_oids)
> ...
> class DataPhys(DataLink): pass
> class DataJur(DataLink): pass
> class DataBus(DataLink): pass
> 
> class DataPerson(DataLink):
>    __phys = None
>    __jur = None
>    __bus = None
>    def __init__(self):
>      super(DataPerson, self, phys, jur, bus).__init__()
>      self.__phys = phys or DataPhys()
>      self.__jur = jur or DataJur()
>      self.__bus = bus or DatadBus()
>      self.__connectAll()
> 
>    def __connectAll(self):
>      for dm in (self.__phys, self.__jur, self.__bus):
>        dm.data_adds.connect(self.data_adds.emit)
> [/code]
> I need to retransmit signals from the members.

You can connect signals to signals just as you can with the old API, so...

    dm.data_adds.connect(self.data_adds)

Phil


More information about the PyQt mailing list