Hello to each and everyone, I'm trying to put in a tableview a checkbox which should be linked to a value in the db of SQlite, the program select first a query and insert data into the table but I want to add a column with a checkbox for each record found in the db. How can i add it to the QSqlQueryModel and Qtableview already created by QTcreator?
Thank you so much

This is my code:
Qt Code:
  1. void myClass::on_pushButton_clicked()
  2. {
  3. Widget conn;
  4. QSqlQueryModel * model = new QSqlQueryModel();
  5. conn.connOpen();
  6. QSqlQuery* qry = new QSqlQuery(conn.db);
  7. qry->prepare("select * from plan where username='"+username_temp+"'");
  8. qry->exec();
  9. QTextStream (stdout) << qry->lastQuery();
  10.  
  11. model->setQuery(*qry);
  12.  
  13. ui->tableView->setModel(model);
  14.  
  15.  
  16. conn.connClose();
  17. qDebug() << (model->rowCount());
  18. }
To copy to clipboard, switch view to plain text mode