On Thu, 17 Jun 2010 14:42:46 +0200, David Mugnai <[email protected]> wrote: > Hi phil, > > according to the docs, the QThread::run method should call exec (and > thus start a new event loop), but this code doesn't work (it never ends) > > >> #!/usr/bin/env python >> #-*- coding: utf-8 -*- >> >> from PyQt4.Qt import * >> >> app = QApplication([]) >> >> class Start(QEvent): >> def __init__(self): >> QEvent.__init__(self, QEvent.User) >> >> class Receiver(QObject): >> def doSomething(self): >> print 'doSomething' >> qApp.quit() >> >> class Main(QObject): >> def test(self): >> r = self._r = Receiver() >> t = self._t = QThread() >> r.moveToThread(t) >> QObject.connect(self, SIGNAL('test'), r.doSomething) >> t.start() >> self.emit(SIGNAL('test')) >> >> main = Main() >> main.test() >> app.exec_() > > If, intead of a QThread, I use a class like this: > >> class MyThread(QThread): >> def run(self): >> return self.exec_() > > > all works as expected.
Should be fixed with tonight's SIP snapshot. Thanks, Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
