path: root/src/sql/kernel/qsqldatabase.h
diff options
authorThiago Macieira <>2014-06-19 12:27:09 -0700
committerThiago Macieira <>2014-06-20 21:21:43 +0200
commit443f06a2ec1b1ba7da3d64151c6e92a3c77deadf (patch)
treec1497b87a6bdaeb3e9a06748182d2420d12b2181 /src/sql/kernel/qsqldatabase.h
parent173412f047c32a623388a7466ab42e2d5bce0a17 (diff)
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 <> Reviewed-by: Friedemann Kleint <> Reviewed-by: Mark Brand <>
Diffstat (limited to 'src/sql/kernel/qsqldatabase.h')
1 files changed, 6 insertions, 1 deletions
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
+ char *defaultConnection;
static QSqlDatabase addDatabase(const QString& type,
const QString& connectionName = QLatin1String(defaultConnection));