[PyQt] Adding a widget to a layout that belongs to a QGroupBox
changes that widget's parent?
apaku at gmx.de
Fri Aug 14 07:39:09 BST 2009
On 13.08.09 15:34:44, Nate Reid wrote:
> I'm using PyQt 4.5.1
> For some reason the parent is changing, but only when a QGroupBox is used...
No, if you have widget A added to a layout thats set on widget B and
widget A's parent is not widget B then A is _always_ reparented to B.
The code for that is in qwidget.cpp and qlayout.cpp. IIRC this is also
documented in the QLayout api docs.
> Another odd thing is that if I uncomment out the line "self.layout.addWidget(self.box), it crashes (e.g. stalls out completely, and I have to kill the shell)
Recursive layouts are not supported by Qt, i.e. you can't add the box to
the box' layout.
Blow it out your ear.
More information about the PyQt