I'm trying to implement a single QSqlDatabase
instance for all instances of my class.
#include <QCoreApplication>
#include <QtSql/QSqlDatabase>
class MyClass
{
static QSqlDatabase db;
};
QSqlDatabase MyClass::db = QSqlDatabase::addDatabase("QSQLITE");
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
But this code doesn't seems to work in Release mode:
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
Screen (error)
I've used windeployqt.exe to build independent Release version.
In Debug this works because sqldriver loaded directly from Qt directory. When i'm trying to put it to release it makes no sense.