QGroupBox does not scale with contents and disappears when resizing the program
-
Hi! I am using a mixed approach in developement qith Qt: I usually place the widgets using QtDesigner, order them in layouts and add a grid layout to the application / widget and I use CPP to achieve some configuration programatically.
I am having a problem with the QGroupBox with this approach. I created three group boxes and put layouts with widgets into them using QtDesigner. The enabled/disabled and radiobutton properties work great. However, I cant't figure out how to set the size of the group boxes to fit the contents of the layouts I put inside them. What happens is, if I don't stretch the objetcts myself, when the program launches, the contents are cut, not all of what I need is visible.
What I want to achieve? After putting all of the widgets on the page to a grid layout, I want to resize the page to minimum size, which should be sufficient to contain all of the contents without cutting any text or buttons.
Here is my MainWindow in QtDesigner:
And when I do the grid layout and try resizing:
-
Hi
The red layouts are meant to be used inside other layouts.
They wont snap to the widget and sort of float around.So they are not the main way to apply a layout to a widget.
It is to right-click the QWidget and use the layout menu.And yes, it is counterintuitive when all the other widgets are dragged from the right. :)
-
-
@szumial
Hi
Yep. Those red layouts are very tempting to use :)However, its completely the other way,
you place some widgets on another widget, then
apply layout :)
Ps. If you see the layout menu being disabled,
It's because you must place at least one widget.Also, since you are a Mixer like me
be aware that the Designer sort of flattens the "tree" a bit with layoutso a layout is available via
ui->layoutname->
and not like one might think
ui->widgetname->layoutname
Even one did right-click that widget and assign a layout.