Advertisement
Guest User

qt 4.7 signal limit test

a guest
Feb 9th, 2011
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import sys
  2. from PySide import QtCore, QtGui
  3.  
  4. class Window(QtGui.QMainWindow):
  5.  
  6.     def __init__(self):
  7.         super(Window, self).__init__()
  8.         self.timer = QtCore.QTimer(self)
  9.         self.timer.timeout.connect(self.onTimeout)
  10.         self.n = 0
  11.  
  12.         self.timer.start(1000)
  13.  
  14.     @QtCore.Slot()
  15.     def onTimeout(self):
  16.  
  17.         exec("Window.sig%d = QtCore.Signal(object, object)" % self.n)
  18.         eval("self.sig%d" % self.n).connect(self.onSignalN)
  19.  
  20.         for i in xrange(self.n+1):
  21.             eval("self.sig%d[object, object]" % i).emit( i,self )
  22.  
  23.         self.n += 1
  24.         print ""
  25.  
  26.     @QtCore.Slot(object, object)
  27.     def onSignalN(self, o1, o2):
  28.         print o1,
  29.  
  30. app = QtGui.QApplication(sys.argv)
  31.  
  32. win = Window()
  33.  
  34. win.resize(320, 240)
  35. win.setWindowTitle("Hello, World!")
  36. win.show()
  37.  
  38. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement