Changing location of plugins



  • I have created an database application that uses QODBC driver, and all worked on my computer.
    i deployed it on another computer, i get errors when running my application. I remark that Qt has kept the path for accessing to plugins as C:/../../plugins, so i create this same path on client machine before my application works.
    Now i want to change the plugins's path to my directory of my project but i dont know how do it? i have read documentation and i fall on 'Using qt.conf' but i dont really understand.

    Thanks for advance.



  • Easiest is to do this file layout:
    @
    MyApplication.exe
    QtCore4.dll
    QtGui4.dll
    QtSql4.dll
    <other needed Qt libs>
    sqldrivers\qodbc4.dll
    sqldrivers\qsqlite4.dll
    sqldrivers\qmysql4.dll
    @


  • Moderators

    You might also want to look at the "libraryPaths":/doc/qt-4.8/qcoreapplication.html#libraryPaths property in QCoreApplication (and QApplication).



  • ok,but if i want to use a customized folder like this:

    MyApplication.exe
    QtCore4.dll
    QtGui4.dll
    QtSql4.dll
    <other needed Qt libs>
    myFolder\qodbc4.dll
    myFolder\qsqlite4.dll
    myFolder\qmysql4.dll

    or my application'paths like this:
    MyApplication.exe
    QtCore4.dll
    QtGui4.dll
    QtSql4.dll
    <other needed Qt libs>
    qodbc4.dll
    qsqlite4.dll
    qmysql4.dll

    How do i do it?

    [quote author="Andre" date="1334060691"]Easiest is to do this file layout:
    @
    MyApplication.exe
    QtCore4.dll
    QtGui4.dll
    QtSql4.dll
    <other needed Qt libs>
    sqldrivers\qodbc4.dll
    sqldrivers\qsqlite4.dll
    sqldrivers\qmysql4.dll
    @
    [/quote]



  • All the sql plugin must be in a directory which called sqldrivers , but this directory can be put anywhere.

    Otherwise, you need to change the soucecode of Qt.



  • [quote author="1+1=2" date="1334612996"]All the sql plugin must be in a directory which called sqldrivers , but this directory can be put anywhere.[/quote]

    The default search path is in the exe's directory + sqldrivers and the Qt installation directory. For putting the plugins subdirectories into other locations one needs to set the library search path of the application (QCoreApplication::addLibraryPath or qtconfig.ini(?)).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.