Qt World Summit: Register Today!

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?
    QSqlQueryModel *model;
    QSqlDatabase db;


    db = QSqlDatabase::addDatabase("QSQLITE");
    this->model = new QSqlQueryModel;
    model->setQuery("select dBpath from setting");
    //qDebug() << model->data(0).toString();


  • Solved ... ui->setup was called after adding data to combobox and not before it.

Log in to reply