I have 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();
New table which I have created is appending in the center of the cell which is looking awkward. Is there any way to fit the child table to the parent cell? I tried to change QTextTableFormat but nothing worked.