diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index f8ecabee8f..84e01fce49 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -107,7 +107,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, QLatin1String("/sqldrivers"))) #endif -QT_STATIC_CONST_IMPL char *QSqlDatabase::defaultConnection = "qt_sql_default_connection"; +#if !defined(Q_CC_MSVC) || _MSC_VER >= 1900 +// ### Qt6: remove the #ifdef +const +#endif +char *QSqlDatabase::defaultConnection = const_cast("qt_sql_default_connection"); typedef QHash DriverDict; diff --git a/src/sql/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h index 7249e223a5..ffc10cdd30 100644 --- a/src/sql/kernel/qsqldatabase.h +++ b/src/sql/kernel/qsqldatabase.h @@ -113,7 +113,12 @@ public: QSqlDriver* driver() const; - QT_STATIC_CONST char *defaultConnection; + static +#if !defined(Q_CC_MSVC) || _MSC_VER >= 1900 + // ### Qt6: remove the #ifdef + const +#endif + char *defaultConnection; static QSqlDatabase addDatabase(const QString& type, const QString& connectionName = QLatin1String(defaultConnection));