Jedi Schmedi Jedi Schmedi - 6 months ago 65
C++ Question

QListWidget, insert linebreak for longer text

I want to use

QListWidget
to display my content. But some of the content is quite long and I want to make the text continue on a second row instead of showing a horizontal scrollbar.

I use Qt Creator and I can't seem to find any options in the design view.

Answer Source

Enable word wrapping by calling

void    setWordWrap ( bool on )

and set text elide mode to Qt::ElideNone

void    setTextElideMode ( Qt::TextElideMode mode )

Also you may check that you didn't set too small maximum height for your items in the list.

P.S. Because you wrote about horizontal scrollbar, you definitely want to have multiline text in item, but not the item on multiple rows.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download