[PyKDE] PyQT Segfault on widget removal.

Vio vmilitaru at sympatico.ca
Wed Jun 18 13:24:00 BST 2003


Henry Kleynhans wrote:

>Hi Vio,
>
>Thanks for the reply.
>
>Would you use deleteLater() instead of removeChild() ?
>
>The problem is that it works if the button is not inside another widget
>which gets removed.  If you have the button on the QMainWindow instead of
>the TestWidget, it works fine, but as soon as you put in into another
>widget it does not work.
>

Honestly, I never used "removeChild()", at least I don't recall.

But "deleteLater()" is pretty straightforward: I just call this method 
on the object I want to zap, and don't have to worry about its parent or 
children or anything.
But I don't understand your problem: are you trying to remove a button 
whose parent also gets removed? I think the rule is that if you remove a 
widget, all its children also get removed, and its parent automatically 
updates its children list. So if you have a QFrame with a QButton 
inside, if you remove the parent QFrame, the QButton also gets removed 
automatically - without you having to explicitly remove it.

I hope I understand you correclty.
Vio





More information about the PyQt mailing list