qlands
16th October 2014, 08:48
Hi,
I have a class that has a QSqlDatabase as a private member.
private:
QSqlDatabase m_database;
I use m_database in several functions of the class like:
QSqlQuery *query = new QSqlQuery(m_database);
..
delete query;
However in the destructor of the class I remove the connection with
m_database.close();
QSqlDatabase::removeDatabase("MyConnection");
But I always get the warning "MyConnection' is still in use, all queries will cease to work."
How can I avoid the warning?
I have a class that has a QSqlDatabase as a private member.
private:
QSqlDatabase m_database;
I use m_database in several functions of the class like:
QSqlQuery *query = new QSqlQuery(m_database);
..
delete query;
However in the destructor of the class I remove the connection with
m_database.close();
QSqlDatabase::removeDatabase("MyConnection");
But I always get the warning "MyConnection' is still in use, all queries will cease to work."
How can I avoid the warning?