[PyQt] Next Releases of PyQt and SIP

melkor at orangepalantir.org melkor at orangepalantir.org
Tue Sep 8 12:58:21 BST 2009


Here is a minimal test case, which works fine my computer at work: windows
xp, and the current release of PyQt with python 2.6.  This script is very
similar to the one I have at home, and I expect that it would fail, but I
haven't seen this script fail so Ill try it at home this afternoon.  If it
fails Ill try a newer snapshot.

mbs

from PyQt4 import QtGui,QtCore
import sys

class WhenDeleted(QtCore.QThread):
    def __init__(self,app,parent=None):
        QtCore.QThread.__init__(self,parent)
        self.connect(self,QtCore.SIGNAL("finished()"),self.echo)
        self.connect(self,QtCore.SIGNAL("started()"),self.stop)
    def run(self):
        self.exec_()
        print "finished here"
        self.deleteLater()
    def stop(self):
        self.quit();
    def echo(self):
        print "Recieved finished() signal"
        app.quit()

if __name__=="__main__":
    app = QtGui.QApplication(sys.argv)
    x = WhenDeleted(app)
    x.start()
    sys.exit(app.exec_())

> On Mon, 07 Sep 2009 20:44:13 -0400, Matt Smith <melkor at orangepalantir.org>
> wrote:
>> The long and short, when I use a QThread at the end of my run method, I
>> call self.deleteLater().  If I call self.deleteLater() the "finished()"
>> signal is never emitted.  It used to emit "finished()" even if I called
>> deletLate(), and I thought I needed the self.deleteLater() to clean up
>> connections and such.
>>
>> If interested I could easily post an example.  If not Ill emit
>> "finished()" before the delete later.
>
> I would need a test case, and to know which versions you are talking
> about.
>
> Phil
>




More information about the PyQt mailing list