I have the following code inside a pushbutton event. When it runs the data does not show up on the QTableView's grid. There are 74 rows in the model, the "for" statement sends them out to the console correctly.
What am I doing wrong?
void MainWindow::on_pushButton_clicked()
{
DBMgr dbmgr;
if (!dbmgr.OpenDB("moz_downloads","","downloads.sqlite"))
return;
wrkTable = dbmgr.theModel;
ui->tableView->setModel(wrkTable);
ui->tableView->show();
for (int i = 0; i < wrkTable->rowCount(); i++)
{
QString s
= r.
value("Name").
toString();
qDebug() << s;
}
}
void MainWindow::on_pushButton_clicked()
{
DBMgr dbmgr;
if (!dbmgr.OpenDB("moz_downloads","","downloads.sqlite"))
return;
wrkTable = dbmgr.theModel;
ui->tableView->setModel(wrkTable);
ui->tableView->show();
for (int i = 0; i < wrkTable->rowCount(); i++)
{
QSqlRecord r = wrkTable->record(i);
QString s = r.value("Name").toString();
qDebug() << s;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks