Hello
I'm having an issue getting my application loading the sqldrivers for the QtSql framework.
The sqldrivers were installed in the <application_bundle.app>/Contents/PlugIns/sqldrivers
a qt.conf has been created in <application_bundle.app>/Contents/Resources
containing:
[Paths]
Plugins = PlugIns
(this is the same qt.conf as generated by macdeployqt utility)...
Qt SDK was installed in ~/QtSDK
whenever the application is started, with DYLD_PRINT_LIBRARIES environment variable, I can see that it keeps loading the sqldrivers from the original SDK location (~/QtSDK/Desktop/Qt/4.8.0/gcc/plugins/...)
If I set the environment variable to:
export QT_PLUGIN_PATH=~/Work/mythtv/MythFrontend.app/Contents/PlugIns
Which is where my application is located, then it will load the sql drivers from the application as expected.
I tried putting the qt.conf is every possible location, tried various combination of structure qt.conf, googling showed that this worked for some:
[Paths]
Prefix = .
Binaries = .
Unfortunately, I haven't found a way to run my application, with plugins without setting the QT_PLUGIN_PATH at startup time which is rather ugly.
Previously I was compiling Qt in static mode, so I never had to use plugins... But as compiling Qt is such a chore, I was hoping to use the available pre-compiled Qt libs from Qt web site instead..
Any help would be greatly appreciated.
Thanks in advanced
Regards
Jean-Yves
Added after 1 49 minutes:
I think this is actually a bug in Qt itself.
In src/corelib/global/qlibraryinfo.cpp, in QLibrarySettings::QLibrarySettings() they only look for the application specific qt.conf
if the following condition is true:
if (!QFile::exists(qtconfig) && QCoreApplication::instance())
At that stage in the application runtime, QCoreApplication::instance() always return null (it hasn't been created yet), so it doesn't even try to look for the qt.conf stored in the bundle.
And obviously, it doesn't know where the PlugIns folder should be located...
Bookmarks