The child-parent hierarchy is the following: mainWindow -> centralWidget -> frame -> widget.
Widget is being resized during the application lifetime, however it is always set to a fixed size. I want the QMainWindow to resize based on that - to have a minimum size that is needed to display all the widgets.
To do that I currently have to do this.
widget->setFixedSize(x, y);
frame->setFixedSize(frame->sizeHint());
centralWidget->setFixedSize(centralWidget->sizeHint());
mainWindow->setFixedSize(mainWindow->sizeHint());
It doesn't work properly if I only resize the main window. All parents of widget need to be resized in order for this to work. Is there a more elegant way? Is it possible to make the main window call resize on all of it's children?
NOTE: All widgets except 'widget' have automatic layout management. So I find it strange that they don't resize themselves based on 'widget'.
setMinimumSize()
instead ofsetFixedSize()
? – Chris