该警告可能会存在隐式内存泄漏,是由于多次addDatabase调用出现,解决办法如下
警告:
QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
解决方法:
QSqlDatabase datebase;
if(QSqlDatabase::contains("qt_sql_default_connection"))
datebase = QSqlDatabase::database("qt_sql_default_connection");
else
datebase = QSqlDatabase::addDatabase("QSQLITE");
powered by: 小乌龟在大乌龟背上