[Interest] Qt4 QODBCDriver class and header file no longer in Qt5?
Mark Brand
mabrand at mabrand.nl
Wed Jul 31 16:52:42 CEST 2013
On Wednesday 31 July 2013 15:24:42 Niels Dekker wrote:
> Using Qt 4.8.4, we do:
>
> #include <QtSql/QODBCDriver>
> #include <QtSql/QSqlDatabase>
> ....
> QSqlDatabase db = QSqlDatabase::addDatabase(new QODBCDriver);
>
> This code no longer compiled when we tried to upgrade from Qt 4.8.4 to
> Qt 5.1 (using qt-windows-opensource-5.1.0-msvc2010-x86-offline.exe),
> because the <QtSql/QODBCDriver> header wasn't there anymore.
>
> Has the QODBCDriver class intentionally been removed from Qt 5, or did
> we possibly install Qt 5 incorrectly?
>
>
Niels,
The SQL driver headers were made explicitly private. For the reasoning behind
this, see commit 1ee11474622e7da068fb1cd26f509ed10848a3b5 and the related
change in Gerrit.
If you follow the pattern in the "Detailed Description" [1] of the
documentation of the QSqlDatabase class, you won't need to explicitly
instantiate the driver in your code, or include the header that declares its
constructor.
Mark
[1] https://qt-project.org/doc/qt-5.1/qtsql/qsqldatabase.html#details
More information about the Interest
mailing list