13

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.

1 Answer 1

9

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.

2
  • 1
    You can set the minimum and maximum size, as well as the size policy, when the widget is in a layout. This will allow you to have control of the widget's size.
    – thuga
    Commented Feb 8, 2016 at 8:28
  • 12
    This is very miserable that I have to change minimum and maximum size, although I really only want to change the size! What's the problem, to set a fixed size, for a child-element of a layout? Absolutely annoying and incomprehensible! And very frustrating!
    – peter70
    Commented Nov 23, 2018 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.