Hi - I'm having problems with the following code where a QRunnable emits a 
signal then ends. If you click the button it should print 1,2,3. It 
sometimes works for the first few times but the wrong number of arguments is 
given to the slot after that.

Is this a PyQt bug? I'm using 4.8.3 on Ubuntu (x86). I've tried setting 
autodelete on the runnable to be false but that causes a crash.

Jeremy

-- 
http://www.jeremysanders.net/
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class Runnable(QRunnable):
    def __init__(self):
        QRunnable.__init__(self)
        self.obj = QObject()

    def run(self):
        self.obj.emit(SIGNAL("testsignal"), 1, 2, 3)

class Win(QPushButton):
    def __init__(self):
        QPushButton.__init__(self, "Push me")
        self.tp = QThreadPool()
        self.connect(self, SIGNAL("clicked()"), self.slotClicked)

    def slotClicked(self):
        runnable = Runnable()
        self.connect(runnable.obj, SIGNAL("testsignal"), self.slotTestSignal)
        self.tp.start(runnable)

    def slotTestSignal(self, a, b, c):
        print "Returning from runnable", a, b, c

if __name__ == '__main__':
    app = QApplication(sys.argv)

    w = Win()
    w.show()

    app.exec_()

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to