QtDesigner: Setting fixed size of QLabel

11,050

You can set horizontal and vertical size policies to Fixed or set the maximum height and width additionally. Either in code or in Designer.

Share:
11,050
Lorenzo
Author by

Lorenzo

Updated on September 11, 2022

Comments

  • Lorenzo
    Lorenzo over 1 year

    I have a fixed size label on a QtDesigner form. The label is used to display images, let's assume it's used to display thumbnails of 100x100 px.

    I can set the size of the label but when I put the label in some layout manager the labels get resized to take the whole space. Even if I do it through the Form > Layout in a Grid. The size of the labels is shrunk.

    I believe this is some corner case as labels are not often used to do such things (although they are meant to be able to display images). Is there a workaround to avoid the size of the labels changing when placed in the layout?

  • Lorenzo
    Lorenzo over 11 years
    Thanks, that worked, had to set size policy to Fixed and min and max size