QTableView - get value forom Item
Hi.
I have some tables QTableView, I shown in this QTableView a table from my database. I do not generally been the case with the larger problems. And I did this:
Code:
// Wybór tablicy danych
model->setTable("testowa");
model->select();
ui->table->setModel(model);
I would to be able to get the contents (value) of a cell.
I hope that I wrote well :) ( in English ) :)
Re: QTableView - get value forom Item
there are two ways
1. using QAbstractItemModel::data method
Code:
...
int row = 0;
int column = 0;
model->data(model->index(row, column), Qt::DisplayRole);
...
2. using QSqlQueryModel::record
Code:
...
int row = 0;
int column = 0;
model->record(row).value(column);
...
Re: QTableView - get value forom Item
This is what I meant.
Thanks:)