Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does QT designer re-size or not allow me to shrink or expand widgets or buttons?

Often times while using QT designer I find myself needing to re-size things either by shrinking or expanding them. Whenever I try to do this the program does not allow me and simply reverts to the original default size it gives me when placing the object within my window, regardless of the layout I have. Why does it do this? And is it possible to change this so that I can re-size things to my own will without restrictions? I have been trying to learn how to properly use QT designer, but I can't find much information on this on the internet.

like image 444
Randomator Avatar asked Feb 07 '16 14:02

Randomator


1 Answers

Anything placed in a "Layout" will be automatically resized to fit in the layout. This is so Qt can do automatic resizing if the user resizes the form at run-time.

If you want absolute placement, the simplest way is just don't use the layouts, place things directly on the MainForm. You could also place a "container" (Group box, Tab widget) inside a layout and place components inside that; the containers don't act like Layouts. It's all in the manual.

As thuga mentioned, you can set the minimum and maximum size and the size policy to override the automatic sizing when the widget is in a layout. This would be ok for a couple of particular widgets among an otherwise auto sizing group.

like image 181
Mbo42 Avatar answered Sep 28 '22 06:09

Mbo42