PDA

View Full Version : QTableWidget problem



sabonis
6th May 2010, 17:33
I have created a table using this code:

QTableWidget* myTable = new QTableWidget;
myTable->setColumnCount(10);
myTable->setRowCount(10);
for(int i = 0; i < 10; ++i)
for(int j=0;j <10; ++j){
myTable->setItem(i, j, new QTableWidgetItem("HELLO!"));
}

myTable->show();
connect(myTable->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onTableModeldataChanged(const QModelIndex &, const QModelIndex &)));

When I edit an element in the table (for example changing the string hello) the onTableModelDataChanged slot is called as expected. The QModelIndex is valid but the internal pointer is always null.
Why???