Reputation: 164357
What I'm trying to accomplish is a very simple and straight forward need, or I thought, but for the life of me, I can't seem to find a way to do it.
In my qt application I want to be able to make a widget or a layout fill the entire space of the parent widget.
For example, let's say I want to have a label with a fixed height and beneath it a stacked widget which occupies the rest of the height of the window. Here's what I do in the qt-creator designer:
verticalLayout
object and in the layoutStretch
property have 0,1
Now, how do I make the verticalLayout
occupy all of the width/height of the centralWidget
?
Nothing seems to work for me.
Thanks.
Upvotes: 7
Views: 7565
Reputation: 98505
You've merely put two widgets in a layout, but you also need a layout on their parent widget - on the form. Here's what you should do instead:
Drag any number of widgets to the parent widget (the form). Arrange them roughly the way you want them to be once laid out.
Right click on the form. Select "Lay out >" submenu.
Choose the desired layout from the menu: horizontal, vertical, grid, etc.
Upvotes: 5