You just have to combine the two functions:
QAbstractItemModel *model
= ui
->tableView
->model
();
// if you don't have a class wide pointer to your model; if (!model)
return;
if(!index.isValid)
return;
qDebug() << index.data().toString();
QAbstractItemModel *model = ui->tableView->model(); // if you don't have a class wide pointer to your model;
if (!model)
return;
QModelIndex index = model->index(1,1);
if(!index.isValid)
return;
qDebug() << index.data().toString();
To copy to clipboard, switch view to plain text mode
Bookmarks