Reputation: 4706
I am using the following example
class bar(QObject):
def mySlot(self,p):
print "This is my slot " + str(p)
class Foo(QObject):
trigger = pyqtSignal()
def my_connect_and_emit_trigger(self):
self.trigger.emit(12)
def handle_trigger(self):
# Show that the slot has been called.
print "trigger signal received"
b = bar()
a = Foo()
a.trigger.connect(int,b.mySlot) <---how to fix this
a.connect_and_emit_trigger()
I am trying to attach the slot b.mySlot
which takes one int parameter to a signal a.trigger
my question is what am I doing wrong. I could not find any material that helps with parameters of signals.
Upvotes: 2
Views: 2331
Reputation: 447
this is correct:
class bar(QObject):
def mySlot(self,p):
print "This is my slot " + str(p)
class Foo(QObject):
trigger = pyqtSignal(int)
def my_connect_and_emit_trigger(self):
self.trigger.emit(12)
def handle_trigger(self):
# Show that the slot has been called.
print "trigger signal received"
b = bar()
a = Foo()
a.trigger.connect(b.mySlot)
a.my_connect_and_emit_trigger()
Doc is here
Upvotes: 3