PDA

View Full Version : Qlabel size string too long



Pharell
10th June 2008, 10:55
Hi ppls,

I have a statusbar on which I add three Qlables. I set the string on these three lables. Sometimes i have too long strings. This is really ugly because the other two lables would not be seen. How can i break such long strings in order to let the other two qlables seen.??

Thanx in advance.

JimDaniel
10th June 2008, 15:20
not sure what your ultimate intention is, but here are some pointers:

If you want the text of a QLabel to wrap to the next line, call label->setWordWrap(true);

Are you using layouts to position the labels in the status bar? Or are you hard-coding the positions? With layouts they would adjust to accomodate the size.

Call label->adjustSize() whenever you set new text to a QLabel to make sure the label is large enough to fit the new text.