Word Wrap of Text in QLabel

From Qt Wiki
Revision as of 16:14, 24 March 2016 by Wieland (talk | contribs) (clean-up)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Text content in QLabel can wrap lines along word boundaries with the wordWrap property. By default, word wrap is disabled. To enable it use setWordWrap():

QLabel *pLabel = new QLabel(this);
pLabel->setText("first line\nsecond line\nthird line\n");
pLabel->setWordWrap(true);