Solved How to extends QLabel class for arranging text inside it
-
Good day!
A little question:
I have a few QFrames arranged inside QHBoxLayout. Each QFrame has one QHBoxLayout. Each QHBoxLayout contains a few QLabel items with some text. Inside QHBoxLayout every QLabel has their own stretch factor value. I'm setting up this using "layout->setStretchFactor();".I have a problem - if a QLabel contains a lot of text, Layout could not compact it according Stretch Factor which I set for this Label. How to extends QLabel class to arrange text to a few lines in situatuin of compressing QLabel width using QHBoxLayout?
Thank you!
-
There is text elide examples in Qt examples directory of your installation. Which may help you.
-
Hi
If you want it to break a long line to multiple lines,
then you should make sure word wrap is enabled.
If you mean, it should reduce font size, you need to subclass it and handle that yourself. -
Hi,
Out of curiosity, why not use one of Qt's text oriented widgets like QTextEdit ?
-
Thank you, QTextEdit works according my needs!