How can I get QTableWidget to work with rich text, word wrapping and resizing rows to contents correctly?
Solved
General and Desktop
-
Hi,
I'm using a QTableWidget and when I add QTableWidgetItems into it, it works with word wrapping and resizing rows to contents, but the items don't support rich text.
I thought the solution to that would be to use a QLabel as the cell's widget. While this does provide rich text support and word wrapping, resizeRowsToContents() doesn't seem to work correctly any more. Resizing the window containing the table and then calling resizeRowsToContents() can easily get the table into a situation where the QLabels haven't been sized large enough to display the entire text assigned to them.
Is there a way to get this to work?
-
Hi and welcome to devnet,
Following this thread, QTextDocument is the way to go.