Reputation: 64283
I am using QHBoxLayout to show 5 widgets horizontally aligned.
If I hide and show one widget, it gets resized. How do I prevent this from happening?
Upvotes: 1
Views: 1870
Reputation: 4674
You can't. If you hide a widget, it's gone from screen and everything else will be resized/reordered to fit the available space as best as possible.
However, you can replace your widget with spacing, cf. QBoxLayout::addSpacing
or QBoxLayout::addSpacerItem
which you set to the width of the widget you hide.
Upvotes: 2