[PyQt] object using deleteLater(), signal destroyed() not emitted

2009-11-15 Thread Wilbert Berendsen
Hi,

in recent sip releases (on my Karmic system, 4.9.1-snapshot), the signal 
destroyed() is not emitted (as least not by PyQt) when a remote object 
destroys itself using deleteLater().

in sip 4.7.9 it works perfectly.  The qobject in question is a KDE readonly 
part (KonsolePart) that destroys itself using deleteLater() when the user logs 
out of the terminal. I want to notice the logout and hide the widget, 
recreating the part when the terminal view is requested again.

But as said, in sip 4.9.1.x the slot connected to the part's destroyed() 
signal is not called. Attached is a small (KDE) test app to demonstrate the 
problem.

Is this a bug or should I use another way of doing this?

Attached the small test app. When the user logs out the terminal, a message 
should be printed on stdout.

w best regards,
Wilbert Berendsen

-- 
http://www.wilbertberendsen.nl/
You must be the change you wish to see in the world.
-- Mahatma Gandhi
#!/usr/bin/env python

import os, sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.kdecore import *
from PyKDE4.kdeui import *
from PyKDE4.kparts import *

aboutData = KAboutData(
'libkonsoleparttester', '',
ki18n('libkonsoleparttester'), '1.0',
)

KCmdLineArgs.init(sys.argv, aboutData)

app = KApplication()

mainwin = KParts.MainWindow()
app.setTopWidget(mainwin)

factory = KPluginLoader(libkonsolepart).factory()

part = factory.create(mainwin)
mainwin.setCentralWidget(part.widget())
part.openUrl(KUrl(os.environ[HOME]))

def slotDestroyed():
print Konsole part destroyed

QObject.connect(part, SIGNAL(destroyed()), slotDestroyed, Qt.DirectConnection)

mainwin.show()
app.exec_()
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] object using deleteLater(), signal destroyed() not emitted

2009-11-15 Thread Phil Thompson
On Sun, 15 Nov 2009 20:53:44 +0100, Wilbert Berendsen wbs...@xs4all.nl
wrote:
 Hi,
 
 in recent sip releases (on my Karmic system, 4.9.1-snapshot), the signal 
 destroyed() is not emitted (as least not by PyQt) when a remote object 
 destroys itself using deleteLater().
 
 in sip 4.7.9 it works perfectly.  The qobject in question is a KDE
readonly
 
 part (KonsolePart) that destroys itself using deleteLater() when the user
 logs 
 out of the terminal. I want to notice the logout and hide the widget, 
 recreating the part when the terminal view is requested again.
 
 But as said, in sip 4.9.1.x the slot connected to the part's destroyed() 
 signal is not called. Attached is a small (KDE) test app to demonstrate
the
 
 problem.
 
 Is this a bug or should I use another way of doing this?
 
 Attached the small test app. When the user logs out the terminal, a
message
 
 should be printed on stdout.

Fixed in current snapshots.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt