SQLite Model to ComboList crashes the program
-
Hi Guys,
I read a SQL dB correct using QSQLQueryModel. When I try to assign this model to the combolist on the ui, the program crashes.
If I print the number of rows output from the query, it is correct. How can I read the data from the model? And where is my mistake here?
@
header
QSqlQueryModel *model;
QSqlDatabase db;cpp
db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(dB_Setting_Path); db.open(); this->model = new QSqlQueryModel; model->setQuery("select dBpath from setting"); //qDebug() << model->data(0).toString(); ui->listView->setModel(model);
@
-
Solved ... ui->setup was called after adding data to combobox and not before it.