QTextTable::insertColumns() don't work
Hi, why insertColumns() dont'work in this example?
Code:
#include <QDebug>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QTextTable>
#include "mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
){
lay->addWidget(edit);
changeTable
= new QPushButton ( trUtf8
("Change table") );
connect( changeTable, SIGNAL( clicked(bool) ), SLOT( SlotChangeTable() ) );
lay->addWidget(changeTable);
setCentralWidget(w);
// addTable
tableFormat.setAlignment(Qt::AlignCenter);
tableFormat.setCellPadding( 4 );
tableFormat.setCellSpacing( 0 );
edit->textCursor().insertTable(3, 7, tableFormat);
cursor.setPosition(1);
edit->setTextCursor(cursor);
QTextTable* table
= edit
->textCursor
().
currentTable();
table->mergeCells( 0, 0, 2 , 1);
table->mergeCells( 0, 1, 2 , 1);
table->mergeCells( 0, 2, 2 , 1);
table->mergeCells( 0, 3, 2 , 1);
table->mergeCells( 0, 5, 2 , 1);
table->mergeCells( 0, 6, 2 , 1);
table->mergeCells( 2, 0, 1, 6);
}
MainWindow::~MainWindow()
{
}
void MainWindow::SlotChangeTable()
{
QTextTable* table
= edit
->textCursor
().
currentTable();
qDebug() << table->columns();
table->insertColumns(1,1);
}