#include <QApplication> #include <QStandardItem> #include <QStandardItemModel> #include <QTableView> int main(int argc, char **argv) { QApplication app(argc, argv); QStandardItemModel *model = new QStandardItemModel; model->setItem(0,0,new QStandardItem("1")); model->setItem(1,0,new QStandardItem("2")); model->setItem(0,1,new QStandardItem("10,000")); model->setItem(1,1,new QStandardItem("20,000")); QTableView *view1 = new QTableView; view1->setModel(model); view1->show(); return app.exec(); }