To do this, you have to pass your data to a model and then you can use QTableView to display your data; to set a model for a table use the following sample:
// creating a 4*4 table
QStandardItemModel* table_model = new QStandardItemModel(4, 4);
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 4; ++column) {
QStandardItem *item = new QStandardItem((QString())); // you should set your data here (in this case as a string)
table_model.setItem(row, column, item);
}
}
then you should pass the model to a tableview:
QTableView table;
table.setModel(table_model);
table.show();