Applying a Qt::TextFlag to the cells of a QTableWidget
I am trying to apply a Qt::TextFlag like Qt::TextWordWrap to the cells of my QTableWidget but could not find a function to do that.I feel this should be straight forward but can't quite nail it down.
Any help would be appreciated.
Are you looking for "this":http://qt-project.org/doc/qt-4.8/qtablewidgetitem.html#setFlags ?
Thanks SGaist for the reply,
I have tried that function but I got build errors saying that getting the following error:
QTableWidgetItem::setFlags”: Cant transform a“Qt::TextFlag”into a “Qt::ItemFlags”
The effect I want is this:When a user writes text in the cell,and text goes beyond the width of the cell,we automatically jump to the next line(in the same cell). I was hopping this setting could help with that.Is this a good way to go about it?
Ho, sorry, I have mixed both set of flags.
Did you try with setWordWrap(true) on your QTableWidget ?
Thanks SGaist,for the input
I tried setWordWrap(true) and unfortunately it didn t work for me.I was able to get the effect I wanted by inserting QTextEdits into my cells.
It requires much more handling when adding /removing rows but its the best option I got so far. :-)
Did you thought about making a QStyledItemDelegate ?