3
votes

Here is the similar question: "QLabel auto multiple lines multiple-lines"

You can see the privious question in the end of this question. Now the question turn to how can I adjust the width of the label in the following picture? enter image description here

-------------------------------- the previous question --------------------------------

I did use the "labelName->setWordWrap(true);"

While the question I come across is in the following picture: enter image description here

From above, we cannot see the two lines clearly. How should I deal with it? Comment: It's calling adjustSize() "after" setting the text that works!

1

1 Answers

2
votes

You need to increase height of your QLabel. You could do this automatically by calling adjustSize() member function after setting the text. Proper layout setting should also help.

In order to set minimum width of your widget you need to call, well, setMinimumWidth:

labelName->setMinimumWidth(width);