[PyQt] KAction gets deleted prematurely

Wilbert Berendsen wbsoft at xs4all.nl
Fri Feb 12 18:56:50 GMT 2010


I just upgraded to KDE 4.4 and SIP 4.10 (using Python 2.6.4).

I noticed that when I call addAction() method of a KActionCollection, the 
resulting KAction object gets deleted as soon as it goes out of scope. But it 
shouldn't as it is a QObject that has the KActionCollection instance as a 

When I call action.setParent(collection) to set the actioncollection as the 
parent (again! but now from Python), the KAction object is not garbage 

Is this a bug in the PyKDE4 sip definition files or am I doing something 

When I connect to the triggered signal in the old way (using 
QObject.connect(action, SIGNAL("triggered()") etc etc) the KAction gets 
deleted, but not when I use the modern way: action.triggered.connect(func)

w best regards,
Wilbert Berendsen

"You must be the change you wish to see in the world."
        -- Mahatma Gandhi

More information about the PyQt mailing list