I am at home using the most recent version of pyqt and sip (20090906)
that I compiled on linux amd64. I am using Qt 4.5.0 that comes with
ubuntu 9.04. The example that I sent does not work because the
"finished()" never gets emitted if I include the 'deleteLater' call.
I do not have dbus if that makes a difference.
mbs
On Tue, 2009-09-08 at 08:15 +0100, Phil Thompson wrote:
> On Mon, 07 Sep 2009 20:44:13 -0400, Matt Smith <[email protected]>
> 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
#!/usr/bin/env python
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() #comment out this line and it works
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_())
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt