Re: QMainWindow size policy
Hi,
If you use central widget, the window take ownership of the widget, meaning that the widget will fit the whole size of the window. If you want to resize your widget so resize the window with setGeometry(). If you want a widget that fits almost the whole area of your widget use layouts.
Sizing is not complicated in QT. Its very easy, it just follows a different philosophy.
Re: QMainWindow size policy
Quote:
Originally Posted by
Caius Aérobus
How it works?
Size policy only works when a widget is inside a layout. Since your main window is a window, it is not inside any layouts so its size policy is ignored.
Quote:
I can't understand how it works and how I could make something as simple as asking the main window to just size itself so as to contain the child widget!
Set a size constraint on the layout managing the widget you wish to control the size of its parent.
Code:
mainWindow
()->layout
()->setSizeConstraint
(QLayout::SetFixedSize);