A QSqlTableModel instance is used in the Qt framework to provide an editable data model for a single database table.
void MyWindow::initializeModelBySQL(QSqlQueryModel *model,QTableView *table,QString sql){ model = new QSqlQueryModel(this); model->setQuery(sql); } With this method …
qt qt4 qtableview qsqltablemodel