I have the following code:

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QtSql>
  4. #include <QDebug>
  5.  
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11. QSqlDatabase m = QSqlDatabase::addDatabase("QSQLITE");
  12. m.setDatabaseName(":baza:");
  13. bool ok = m.open();
  14. if (ok)
  15. {
  16. qDebug() << "connected" << endl;
  17. }
  18. else
  19. {
  20. qDebug() << "not Connected " << endl;
  21. qDebug() << QSqlDatabase::drivers() << endl;
  22. qDebug() << m.lastError();
  23. }
  24.  
  25. }
  26.  
  27. MainWindow::~MainWindow()
  28. {
  29. delete ui;
  30. }
  31.  
  32. void MainWindow::changeEvent(QEvent *e)
  33. {
  34. QMainWindow::changeEvent(e);
  35. switch (e->type()) {
  36. case QEvent::LanguageChange:
  37. ui->retranslateUi(this);
  38. break;
  39. default:
  40. break;
  41. }
  42. }
To copy to clipboard, switch view to plain text mode 

and it's returning:

Qt Code:
  1. not Connected
  2.  
  3. ("QSQLITE", "QODBC3", "QODBC")
  4.  
  5. QSqlError(-1, "Error opening database", "unable to open database file")
To copy to clipboard, switch view to plain text mode 

What's wrong?