This example works for me:
class C(qt.QObject):
received = qt.Signal(object)
def __init__(self):
super(C, self).__init__(None)
def process(self, msg):
self.received.emit(msg)
class D(qt.QObject):
def __init__(self, sender):
super(D, self).__init__(None)
sender.received.connect(self.process)
def process(self, msg):
print("Processed this: "+repr(msg))
c = C()
d = D(c)
m = {'h': {'t': 's'}, 'c': {'e': 'i'}}
c.process(m)
(taken from these discussions: Custom Signal/Slots with PythonQt - #6 by ihnorton and PythonQt / Discussion / Help: Segmentation fault after emiting a signal)
However, normally there is no need to create Qt-based Python classes and define new signals and slots, as you can communicate via MRML nodes and VTK event observations:
What is your use case? What would you like to achieve with the custom signals/slots?