[PyKDE] How do I delete a QCanvasItem?

Phil Thompson phil at river-bank.demon.co.uk
Tue Jun 11 00:54:01 BST 2002


Boudewijn Rempt wrote:

> On Monday 10 June 2002 21:29, Stephen Green wrote:
> 
>>I've been trying to figure out how to delete a QCanvasItem from a QCanvas.
>>I tried using del, QCanvas.removeChild() and removing all references to it.
>>None of this works though.  I think removeChild() doesn't work because it
>>takes a QObject as input, but QCanvasItem does not inherit QObject.  Does
>>anybody know how to do this?
>>
>>
> 
> I've just experimented a bit, and I found that canvas items just don't
> disappear. I think that's a bug. The only sure way of making items
> disappear currently is to hide() them, and that could lead to prodigious
> memory leaks.


Thanks for doing the experiments. I plan to implement a method in the 
SIP Python module that will provide direct access to the C++ dtor for 
the rare cases (of which this is probably the only one in PyQt) where 
the API being wrapped is lacking.

The reason that I haven't done it yet is that the SIP module will be 
renamed in the "near" future from "libsip" to "sip", so if I add methods 
now I will soon be breaking them.

Would you prefer to see libsip.sipCallDtor() in SIP v3.3 or can you wait 
for sip.sipCallDtor() in SIP v4.0?

Phil




More information about the PyQt mailing list