[SOLVED] QLabel auto multiple lines


For example, we have a QLabel with MaximumWidth set to 400.
When we try to display some text with pixel width more than 400, it’s shown cut off.
Is there any way to make QLabel display this string in multiple lines without using QFontMetrics or the like?


If I understood your question correctly, you should use the setWordWrap function for your label, with true as its parameter.

QLabel lbl("long long string");

Answered By – s4eed

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *