will addStretch(1) do the trick ? I will probably try it and post the result.
Thanks a lot
will addStretch(1) do the trick ? I will probably try it and post the result.
Thanks a lot
Mithin
www.mithin.in
QBoxLayout::addStretch() will just add empty stretchable space to the end of the box layout. I don't know how the labels are even laid or what's the actual problem here, bu if you call addStretch() always when changing the pixmap of a label, you'll end up having as many spacers in the end of the layout..![]()
J-P Nurmi
Ok Let me explain.
I have a two labels in a horizontal layout. The first label changes text (the new text is smaller in the length then the older text) on an event and therefore it should adjust its width so that the second label is next to it.
Now, in the horizontal layout at the end I add stretch.
My doubt is, will this stretch resize the label automatically ?
Since I am not reimplementing QLabel how can I achieve this resizing?
Thanks a lot.
Mithin
www.mithin.in
What exactly do you mean by "resizing a label"? You mean its content or the widget itself? Because if you only mean the widget, just set its size policy to expanding and the layout will take care of the rest. If you mean the content, then make sure scaledContents property of the label is set to true. That should suffice.
Sorry for digging this old thread but I have the same issue.
I'm trying to write my own Message box class and I need a label to be resized when anybody changes it's content. The label is in a layout but when I set text to the label it doesn't resize the dialog![]()
C++ & AMD forever
Set a layout contstraint on the dialog's layout.
But which layoutConstraint should it be?
C++ & AMD forever
FixedSize, I guess. I'm not really sure what you are doing, so it's just a guess.
THRESHE (6th August 2008)
Bookmarks