QTextEdit *textEdit = new QTextEdit(); QTextCursor cursor(textEdit->textCursor()); cursor.insertTable(3, 3); //inserts a 3x3 table into the textEdit document
QTextDocument *doc = new QTextDocument(); QTextCursor cursor(doc); cursor.insertTable(2, 2);This example creates a QTextDocument object and a QTextCursor object to manipulate the cursor in the QTextDocument. The cursor is then used to insert a 2x2 table into the QTextDocument. Package library: Qt library