Hello!

I'm trying to read from SQLite database. I've wrote simple function:

Qt Code:
  1. void MainWindow::odczytajBazeSQL()
  2. {
  3. QSqlDatabase::addDatabase("QSQLITE");
  4.  
  5. bdb.setDatabaseName("/test.db");
  6. bdb.open();
  7.  
  8. QSqlQueryModel *queryModel = new QSqlQueryModel;
  9. queryModel->setQuery("SELECT * FROM t1", bdb);
  10.  
  11. ui->tableView->setModel(queryModel);
  12. }
To copy to clipboard, switch view to plain text mode 

test.db is a simple database with one table t1. When I'm trying to read with code above I get error:

Qt Code:
  1. QSqlDatabase: QSQLITE driver not loaded
  2. QSqlDatabase: available drivers:
  3. QSqlQuery::exec: database not open
To copy to clipboard, switch view to plain text mode 

Normally I'm using sqlite3 to create and use databases. What should I do to make it work?

thanks in advance
best regards
Tomasz