QListWidget, insert linebreak for longer text

拥有回忆 提交于 2019-12-02 05:55:05

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/20888058/qlistwidget-insert-linebreak-for-longer-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!