Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLite Model to ComboList crashes the program

SQLite Model to ComboList crashes the program

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SherifOmran
    wrote on last edited by
    #1

    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);
    

    @

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SherifOmran
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved