Originally Posted by
ChrisW67
You are looking in the wrong direction. To get a signal when the data changes you need to be looking at the data model not the view:
QAbstractItemModel::dataChanged() for example.
Hi ChrisW67,
I have used this new code:
connect(ui->myTableView->model(), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(onDataChanged(const QModelIndex&, const QModelIndex&)));
...
void myClass::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
qDebug() << "the cell has changed";
}
connect(ui->myTableView->model(), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(onDataChanged(const QModelIndex&, const QModelIndex&)));
...
void myClass::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
qDebug() << "the cell has changed";
}
To copy to clipboard, switch view to plain text mode
And works fine!
Thank you.
Bookmarks