[SOLVED]QLabel inside a QGridLayout
-
Hi guys,
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) :
https://www.dropbox.com/s/ou6v43pqbe18168/heart1.pngafter (incorrect size, too big):
https://www.dropbox.com/s/p2di0dbjnfgym2i/afterHeart.pngStylesheet used for setting image on label :
@#label_23 {
image: url(:/image/icon/heart1);
}@ -
found a workaround, resizing the image outside of qtcreator to my maximum size.
Will have to investigate later and learn how QGridLayout works.. -
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:
https://www.dropbox.com/s/lj8emct35u2uu6z/design1.png
https://www.dropbox.com/s/z4vvonmhntpydj7/design2.pngThank you!
-
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 :)
Thanks!