How to properly layout this form
-
In the first image the layout is good. But this the size in Qt Designer. The second image is this window maximized. You can see that the text in the upper portion has gained height. The widget on the bottom left is a label that will hold a pixmap. The two stacked widgets on the right are QChartViews. What I want is, when the window is maximized, the image label and the charts to increase in size and the text at the top to stay the same. I've tried grouping them together in sections and grid layouts. Nothing I do makes it do what I want it to do. Could I get some advice?
![alt text]( image url)
-
Hi @PsylumDan,
You need to put stretch factor to 1 for your bottom part, so it will grow instead of your text.
With QBoxLayout, you can do that using the second argument of QBoxLayout::addWidget or QBoxLayout::addLayout
With QGridLayout, you can set stretch by row using QGridLayout::setRowStretch -
@PsylumDan Hum Ok,
No, you can do it by clicking on the root widget containing your layout. Then go at bottom of the properties editor, you can see a section
Layout
, here you can change thelayoutStretch
property of each widget.
Example with 2 widgets, by default you have0,0
, you can put0,1
to set the last widget having the "growing priority".Sorry it could be simple with a picture. But I cannot post them because of proxy.
-
@PsylumDan
Hi
You can also do it in Designer.
here told it that to top one should use 2/3 and last should use 1/3
of the space.