Reputation: 182
I use QItemDelegate and QStandardItemModel to display text and images in a QTableView (text and images are stored as richText in my database).
The problem is, that the text does not wrap, when i use QItemDelegate. If i do not use QItemDelegate the text does wrap but images are not displayed.
My Question: How can i make text-wrapping when using ItemDelegate?
Upvotes: 2
Views: 696
Reputation: 26
It works with Qt::TextWrapAnywhere
flag in DrawText
method.
painter->drawText(xText, yText, wText, hText,
Qt::TextWrapAnywhere | Qt::AlignCenter, QString(" ")
.append(m_RowsWithIconAndText.value(index.row())));
Upvotes: 1