How to read data from QTableView?
-
I googled but did not get anything related to what I am looking for.
I have created a table using QStandardModelItem/QTableView but I am not sure how to read the data from the table. I am able to read the header using QStandardModelItem::headerData() but not able to read the table contains. Let me know if there is any better ways to do that.Thanks in advance.....
-
Reading data:
@
item(row, YourColumnNameAsConstansString)->text()
@
or a similar:
@
static_cast<quint16>(item(row, YourColumnNameAsUInt16)->data(Qt::EditRole).toUInt())
@
item is a QStandardItem.In QStandardItemModel you can retrieve the index or item with these: itemFromIndex() and indexFromItem().