Unsolved model ?
-
how to use QStandardItemModel to load data from SQL Server to table view ?
i can use QSqlQueryModel and QSqlTableModel, but QStandardItemModel is not. -
@Duy-Khang said in model ?:
i can use QSqlQueryModel and QSqlTableModel
Those are the most straightforward tools
how to use QStandardItemModel to load data from SQL Server to table view ?
Run a
QSqlQuery
, iterate over the results and load them into the model -
QStandardItemModel *itemModel = new QStandardItemModel(this);
QSqlTableModel *model = new QSqlTableModel(this);
model->setTable("Student");
model->select();and how to use itemModel to setModel and select like model ?
-
You can't. They are 2 different classes doing 2 different things. What's your end goal here?