Layout, widgets and resize questions
Hello,
I have 2 little questions, maybe silly ones:
I have a widget to which I attach a layout. Then I add lots of buttons & co to the layout.
First question:
How can I make the parent widget resize depending on the widgets I add or remove from the layout? I managed to make it grow, but removing widgets from the layout will not make the parent widget shrink. In the end I did it by resizing it myself, but I wonder if there isn't a smarter idea
Second question:
After adding the widgets on the layout, when will the geometry of the widget be updated so I can get the correct height by using widget.height()? After all kind of trials I managed to do that only after calling widget.setVisible(true). It is possible to get the height without that call?
Thank you :o
Re: Layout, widgets and resize questions
Hi,
First of all I wonder why you want to remove your widget? I mean if you want your regarding widget to shrink itself via a widget removal, doesn't it break down the layout of your other widgets, windows, frames etc.
Re: Layout, widgets and resize questions
No, it doesn't. I have a scroll area and the widget we're talking about is the widget set to the scroll area. Something like this:
Code:
theLayout->addWidget(...)
theLayout->addWidget(...)
theLayout->addWidget(...)
sc->setWidget(theWidget);