I am using that.
Qt Code:
  1. void GlavnoO::test_clicked()
  2. {
  3. bool ok = FALSE;
  4. QSqlDatabase *baza = QSqlDatabase::database();
  5. if (baza) {
  6. ok = baza->isOpen();
  7. };
To copy to clipboard, switch view to plain text mode 
Originally it was without 'if (baza) ...' statement.