Results 1 to 2 of 2

Thread: Qt 4.8, mac and sqldrivers...

  1. #1
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 4.8, mac and sqldrivers...

    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...
    Last edited by jyavenard; 28th February 2012 at 07:30.

  2. #2
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Qt 4.8, mac and sqldrivers...

    I reported the following bug, along with the patch to fix the problem.
    https://bugreports.qt-project.org/browse/QTBUG-24541

    There's another bug however, in that qfactoryloader will also ignore the custom Plugins path under some circumstances.

Similar Threads

  1. Wierd behavior when loading sqldrivers
    By BadKnees in forum Qt Programming
    Replies: 0
    Last Post: 19th March 2009, 10:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.