Solved QTableview wordwrap
-
I want to make items wordwrap, but I also set the model by myself( override ). So what should I do?
-
@mihan
So what about https://doc.qt.io/qt-5/qtableview.html#wordWrap-prop,QTableView::setWordWrap(bool on)
? Docs state "This property is true by default.", so it should already be enabled...?It also says "Note that even of wrapping is enabled, the cell will not be expanded to fit all text. Ellipsis will be inserted according to the current textElideMode." So you may want to fiddle with
setTextElideMode(Qt::ElideNone)
too. Further information about possibleresizeRowsToContents()
in https://stackoverflow.com/questions/9544122/how-to-word-wrap-text-in-the-rows-and-columns-of-a-qtablewidget. -
@jonb Thanks~
https://stackoverflow.com/questions/9544122/how-to-word-wrap-text-in-the-rows-and-columns-of-a-qtablewidget. It has been well explained in this topic.