Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixing sizes of widgets in QT designer layouts

Tags:

qt

qt-designer

I have a QT form that has literally hundreds of widgets and to make them all fit on the screen at once (as required) I need to make them pretty small. The Form will have fixed (non resizable) size when used. I can resize the widgets to the desired height/width and use the appropriate (small) font size, make their size policy "fixed" etc. However, as soon as I start putting them into layouts, they gow to some, much larger minimum size. This is particularly true for the height of the widgets, but width is sometimes affectged as well.

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

  1. Change a layout's default minimum size(s) for widgets.

  2. Force a layout not to alter widgets sizes.

  3. Use Qt designer to nicely align widgets in grid-like formats without using layouts.

I searched extensively Qt designer's docs and SO, to no avail.

Help is greatly appreciated

like image 725
stefano Avatar asked May 12 '13 16:05

stefano


1 Answers

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

like image 79
Zlatomir Avatar answered Oct 17 '22 20:10

Zlatomir