Remove the use of QT_STATIC_CONST in QtSql
There doesn't seem to be any reason why the macro is actually necessary. My guess is that someone wrote the code on Windows without "const", then it failed to compile everywhere else. Instead of fixing the code by adding the "const", the developer must have added this macro. Microsoft Visual Studio mangles the constness of the variable, so we can't remove it now from existing compilers. But we can for the new version. This is also required to compile QtSql with the MSVC option /Zc:strictStrings, which is enabled in Qt 5.4. Change-Id: Ibf2c2cb7287a4332d69aa81080a37aab4327677d Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
173412f047
commit
443f06a2ec
@ -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<char *>("qt_sql_default_connection");
|
||||
|
||||
typedef QHash<QString, QSqlDriverCreatorBase*> DriverDict;
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user