Hello! I want to make a table like on the attached picture: 
I use QT classes for this: QTextCursor, QTextDocument, QTextTable
So I have a ΠΏΡΠΎΠ±Π»Π΅ΠΌΠ° Ρ ΠΎΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ΠΌ ΡΡΠ΅Π΅ΠΊ ΠΊΠ°ΠΊ Π½Π° ΠΊΠ°ΡΡΠΈΠ½ΠΊΠ΅ . Now ΠΌΠΎΠΉ ΠΊΠΎΠ΄ ΡΠΈΡΡΠ΅Ρ Π²ΡΠ΅ Π±Π΅Π· ΠΎΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠΉ , as in 5 6 7 columns.
As QTextTable has understood, there is a splitCell() method, but so far I have not understood how best to cram it into my implementation in order to achieve the desired result.
Apparently you have to add an argument to the addTableText function with a list of strings to be combined under a certain condition?
Function code attached below:
The function of adding a table and filling in table headers:
placeTable(QList<QString> headers) { int lines = 1; cursor.movePosition(QTextCursor::End); cursor.insertTable(lines, headers.count(), tableHeaderStyle.tableStyle); freeTableLines = lines; for (int i=0; i<headers.size(); i++) { cursor.setBlockFormat(tableHeaderStyle.parStyle); cursor.insertText(headers[i], tableHeaderStyle.textStyle); cursor.movePosition(QTextCursor::NextCell); } freeTableLines--; } The function of adding text to the table columns:
addTableText(QList<QString> content, RWStyles cstyle) { RWStyle currentStyle; switch ( cstyle ) { case rw_pageheader: cstyle = rw_tableheader; case rw_standard: cstyle = rw_tabletext; case rw_tabletext: { currentStyle = tableTextStyle; } break; case rw_tableheader: { currentStyle = tableHeaderStyle; } break; case rw_redtabletext: { currentStyle = redTableTextStyle; } break; default: break; } QTextTable *table = m_cursor.currentTable(); if ((! table)) { freeTableLines=1; m_cursor.insertTable(freeTableLines, content.count(), currentStyle.tableStyle); } if (freeTableLines==0) { table->appendRows(1); m_cursor.movePosition(QTextCursor::PreviousRow); m_cursor.movePosition(QTextCursor::NextRow); freeTableLines++; } for (int i=0; i<content.size(); i++) { m_cursor.setBlockFormat(currentStyle.parStyle); m_cursor.insertText(content[i], currentStyle.textStyle); m_cursor.movePosition(QTextCursor::NextCell); } freeTableLines--; }