[PyKDE] signal/slots passing args - is this really how it's Done?

Ken Godee ken at perfect-image.com
Fri Feb 6 16:38:00 GMT 2004


Just checking, this really threw me.

Needed to pass an arg to a python function/method
via a Qt object signal.

class timer_up(QDialog):
     def __init__(self,parent = None,name = None,modal = 0,fl = 0, us=0):
         QDialog.__init__(self,parent,name,modal,fl)

         self.num = us
         self.cw = self

         self.timer1 = QTimer(self)
         self.timer1.start(5000)

         self.connect(self.timer1,SIGNAL("timeout()"),self.slottimeout) 

         self.connect( self, PYSIGNAL("timesig"), self.timechk)

     def slottimeout(self):
         self.emit(PYSIGNAL("timesig"), (self.num,self.cw))

     def timechk(self,num,cw):
         dbfunc.timer_cb(cw,num)






More information about the PyQt mailing list