[SOLVED]QLabel inside a QGridLayout
I'm having problem with the auto-sizing of the grid layout.
I want some of my label to have a "maximum size" so it doesn't appear to big
the label should re-size smaller or bigger whenever the windows size is changed (default behavior of GridLayout)
I tried every combination of "size policy" for my QLabel, maximum, fixed, etc. It still take the full size of the image and I can't put a maximum size on it (geometry section is grayed out once in the QGridLayout so I can't play there neither)
before (correct maximum size) :
after (incorrect size, too big):
Stylesheet used for setting image on label :
found a workaround, resizing the image outside of qtcreator to my maximum size.
Will have to investigate later and learn how QGridLayout works..
you can try setFixedWidth and stretch factor for grid columns along with horizontal size policy of label as fixed/maximum.
Thanks for your help.
I set a column minimum width for some column.
The problem seem to be with the QLabel, even when they are fixed/maximum on size policy (horizontal), they still take too much horizontal space for some reason.
Here are the screenshot of the grid:
Can you paste the piece of code in which you are setting layout options and size policies.
I found the problem! I was setting all maximum size policies on the QLabel, but my QGridLayout size was set up too large and nothing could take up all the horizontal extra space. I added horizontal spacer, and every object in the grid take it maximum size now.
I don't want to touch the code it's all generated with designer :)