I'd appreciate advise on to how create a Qt UI consisting of four layouts and has the following properties.
Any increases in the height of the UI is absorbed by the layouts, as shown below
Any further decreases in the height of the UI is absorbed by the contents of a specific layout, e.g. the two large buttons as shown below
I prepared quick code what fits your problem, please take a look: https://github.com/troyane/StackOverflow-pro/tree/master/creating-auto-scaling-qt-ui-using-layouts
Grab that code and take a look at next moments (you can open mainwindow.ui
in QtCreator):
centralWidget
has next layoutStretch
param: 1,2,1,1
-- it means, that we'll have next correlation among all items placed into this vertical layout.TextLabel
and both SmallButton
s has Fixed
VerticalPolicyBigButton
s has Minimum
vertical policy and set minimumSize's Height to 100. UPD: Also maximumSize
->height
parameter is 250
px. So, it is guarantee that both BigButtons will not grow more than 250 px on height. Take a look at another answer, there you can find lots of literature to read about Layouts.