A.Faur
A.Faur

Reputation: 103

Wrap header titles in QTableWidget

I have a QTableView with a QHeaderView set.

I would like to set wordwrap on the header content (QString), but not the table content. Is this possible?

It is dynamic data, so I am not able to use \n in my strings. The columns of my list have a fixed width.

I don't see any wordwrap for this object any where here: http://qt-project.org/doc/qt-4.8/qheaderview.html

I see the question was posted before, but with no useful answers: How to set header titles to wrap in QTableWidget

Thanks in advance !

Upvotes: 1

Views: 2213

Answers (1)

Isamu
Isamu

Reputation: 41

I did it on this way (this method expects using the Qt Designer):

  • throw a QTableWidget into your MainWindow or form

  • double click the TableWidget

  • enter your headings

  • click the button "properties" in the bottom right corner

  • adjust whatever you want

As far as I understood your question, this is the way I did it. Hope it helped you and sorry for my bad english. :)

edit: try tableWidget->setwordWrap(true)

Upvotes: 1

Related Questions