Tables in QTextEdit does not respect constraints
I been trying to insert a table into a QTextEdit with fixed length, using insertTable with QTextTableFormat.
QTextCursor cursor = textEdit->textCursor(); QTextTableFormat fmt; fmt.setColumns(wNumColumn); // add constrains QVector<QTextLength> constraints; for (int i=0;i<wNumColumn;i++) constraints.append(QTextLength(QTextLength::FixedLength,wSizeFixed)); fmt.setColumnWidthConstraints(constraints); fmt.setCellSpacing(0); cursor.insertTable(wNumColumn,wNumRow,fmt);
The table cells does not respect the fixed constraints that I had set, if a single word size is bigger than the column size.
If I use words smaller than the column size, the constraints were respected.
BUT.. if I add "22222....." til the limit of the document and the QTextEdit breaks the line, the table respects size constraints.
Once the table were resize by the line break, all cells respect the width constraints inserted.
How could I fix this behavior? I tried to find some properties in the QTextTableFormat and (QTextTable object returned by the function insertTable) but so far nothing.
Thanks in advance...
I found the problem.
Apparently the QTextTable does not limit the maximum table size when you fixed the column size.