QTableView Does not work
Solved
General and Desktop
-
Hi, this is my init. code of the mainwindow constructor. I can not see where I'm doing wrong? There will be empty tableview when I run it.
QStandardItemModel model(rows, columns); for (int row = 0; row < rows; ++row) { for (int col = 0; col < columns; ++col) { model.setItem(row, col, new QStandardItem(QString("asdasd"))); } } qInfo()<<"This is model:"<<model.item(0,0)->text(); ui->tableView->setModel(&model); ui->tableView->show();
-
Hi, this is my init. code of the mainwindow constructor. I can not see where I'm doing wrong? There will be empty tableview when I run it.
QStandardItemModel model(rows, columns); for (int row = 0; row < rows; ++row) { for (int col = 0; col < columns; ++col) { model.setItem(row, col, new QStandardItem(QString("asdasd"))); } } qInfo()<<"This is model:"<<model.item(0,0)->text(); ui->tableView->setModel(&model); ui->tableView->show();
@canrollas said in QTableView Does not work:
QStandardItemModel model(rows, columns);
Your model is a local variable...