Fix widget sizes in QT designer layouts

I have a QT form that has literally hundreds of widgets and allows them to immediately fit on the screen (as needed). I need to make them pretty small. When used, the form will have a fixed (non-resizable) size. I can resize widgets to the desired height / width and use the appropriate (small) font size, make their size policy "fixed", etc. However, as soon as I begin to put them in layouts, they reach some, much larger minimum size. This is especially true for the height of widgets, but sometimes the width also affects.

My problem would be resolved if I knew how to do one of the following three things:

  • Change the default minimum size (s) for widgets.

  • Make a layout to not resize widgets.

  • Use the Qt constructor to conveniently align widgets as a grid without using layouts.

I searched for detailed Qt and SO docs to no avail.

Help with thanks

+8
qt qt-designer
source share
1 answer

Use layouts with QWidget :: setFixedSize in your code (or alternatively you can set a fixed-size policy for each widget in the designer), or you can use QLayout :: setSizeConstraint

+5
source share

All Articles