Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove a sublayout in qt?

Tags:

python

qt4

pyqt

In PyQt 4.5, I have a layout inside another layout. I'd like to remove the sublayout from its parent, and hide it. I can say parent_layout.removeItem(child_layout) to remove the layout from its parent, but it still shows on the widget. I can't find any way to hide it in one step, as QLayout doesn't have a hide() method like QWidget does.

like image 370
Andrew Magee Avatar asked Nov 16 '25 07:11

Andrew Magee


1 Answers

The easy solution would be to have an interior widget, not an interior layout. You could assign the layout you desire to the widget, then just remove/hide the widget when you want to do so. A good rule of thumb is if you just want to arrange how widgets appear, then use a layout; if you want to hide/show them as a group, use a widget.

like image 111
Caleb Huitt - cjhuitt Avatar answered Nov 18 '25 20:11

Caleb Huitt - cjhuitt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!