I want to print out as many rows as I want in the tableview.
-
Hello, I'm a beginner Qt developer.
I expressed the contents of the DB table in tableview. But the code that I've implemented right now is printing all the rows in the table. This is a result I don't want.
How can I print out the number of rows I want?
This is what the current code is about.
QSqlQueryModel *table = new QSqlQueryModel; QString sql; sql = "select sv,time from hmidata group by sv,time order by time DESC"; QSqlQuery query; if(!query.exec(sql)){ qDebug () <<"query error:" << query.lastError(); } else { qDebug () <<"query access:" << query.lastQuery(); } table->setQuery(query); ui->tableView_gwan->setModel(table); ui->tableView_gwan->showRow(10); ui->tableView_gwan->setSpan(10,2,10,2); ui->tableView_gwan->currentIndex();
Query execution works very well.
-
Hello, I'm a beginner Qt developer.
I expressed the contents of the DB table in tableview. But the code that I've implemented right now is printing all the rows in the table. This is a result I don't want.
How can I print out the number of rows I want?
This is what the current code is about.
QSqlQueryModel *table = new QSqlQueryModel; QString sql; sql = "select sv,time from hmidata group by sv,time order by time DESC"; QSqlQuery query; if(!query.exec(sql)){ qDebug () <<"query error:" << query.lastError(); } else { qDebug () <<"query access:" << query.lastQuery(); } table->setQuery(query); ui->tableView_gwan->setModel(table); ui->tableView_gwan->showRow(10); ui->tableView_gwan->setSpan(10,2,10,2); ui->tableView_gwan->currentIndex();
Query execution works very well.