I actually solved the issue.

Instead i did this...
Qt Code:
  1. QSqlDatabase currentDB = QSqlDatabase::addDatabase("QSQLITE");
  2.  
  3. currentDB.setHostName("MTG");
  4. currentDB.setDatabaseName(temp);
  5. currentDB.setUserName("MTG");
  6. currentDB.setPassword("MTG");
  7. if(currentDB.open())
  8. {
  9. qDebug() << "DB opened successfully";
  10. }
  11. else
  12. {
  13. qDebug() << "DB not opened successfully" << currentDB.lastError();
  14. }
To copy to clipboard, switch view to plain text mode 

Worked great.