QTextTable - create table in cell
I created a table using QTextTable
. Here is my code:
QTextTableFormat tableFormat;
tableFormat.setBackground(QColor(Qt::white));
//tableFormat.setAlignment(Qt::AlignHCenter);
tableFormat.setCellSpacing(0);
tableFormat.setTopMargin(0);
tableFormat.setCellPadding(40);
QTextTableFormat childtableformat;
childtableformat.setCellSpacing(0);
childtableformat.setAlignment(Qt::AlignBaseline);
tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 100));
tableFormat.setCellPadding(10);
cursor.insertText("table below ");
QTextTable* table=cursor.insertTable(3,3,tableFormat);
cursor = table->cellAt(0, 0).firstCursorPosition();
QTextTable* childtable=cursor.insertTable(2,2,tableFormat);
textEdit->show();
The new table I created is added to the center of the cell, which looks awkward. Is there a way to put a child table in a parent cell? I tried to change the QTextTableFormat but nothing worked.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: