main window doesn't re-size when child widget hidden
Hello,
I am designing a UI in which certain user actions (clicking check boxes) can result in various widgets on the UI being hidden or shown. I notice when widgets are shown the layout management system will increase the size of the GUI to accommodate to new items. However in contrast when the widgets are hidden the layout simply resizes/redistributes the existing widgets to fill the leftover space but does not actually reduce the overall size of the top level window. This behavior is not desired, instead I would like the window to actually shrink.
A few questions:
1.) Is there a way to automatically tell a layout to behave in this manner? I havn't found one if there is.
2.) What signal does the layout management system catch (or what event) to know when child widgets have been hidden? Looking at the documentation it doesnt look like a show() or hide() signal is emitted from QWidget.
Re: main window doesn't re-size when child widget hidden
a small suggestion .. but though i wont be a right approach
use stretch factors vertical stretch or horizontal stretch and spacers
http://qt-project.org/doc/qt-4.8/qspaceritem.html
and
http://qt-project.org/doc/qt-4.8/lay...tretch-factors
spacer will make the area reserve for the widget u show and hide..
Quote:
instead I would like the window to actually shrink
resizeEvent() and setFixedSize() can help u ..
Re: main window doesn't re-size when child widget hidden
Take a look at the Extension Example in Assistant
Re: main window doesn't re-size when child widget hidden
The piece I was missing is:
Thats what is needed to cause the widget to resize down to the size hint. Thanks for your help ChrisW67.