Results 1 to 7 of 7

Thread: Qt4 plugin path problem

  1. #1

    Default Qt4 plugin path problem

    I have a problem with QT4 plugin path which is hard-coded into QtCore4.dll directly. I have tried to use addLibraryPath or setLibraryPaths but both didn't work. The only way I can make it work is change the hard-coded path in QtCore4.dll using a hex editor but I don't think it is a good way. Does anyone have a good solution on it?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 plugin path problem

    When do you invoke that method? QCoreApplication loads plugins when you create its instance. Adding a path after the plugins were loaded won't help.

    Also Qt docs say:
    You can also use a qt.conf file to override the hard-coded paths that are compiled into the Qt library. For more information, see the Using qt.conf documentation. Yet another possibility is to set the QT_PLUGIN_PATH environment variable before running the application. If set, Qt will look for plugins in the paths (separated by the system path separator) specified in the variable.

  3. #3

    Default Re: Qt4 plugin path problem

    I invoked the function right after QApplication a(argc, argv);
    Here is my code:

    QApplication a(argc, argv);
    QString path;
    path = QCoreApplication::applicationDirPath();
    QCoreApplication::addLibraryPath(path);

    I tried to call that function before initiating the qApplication:
    path = QCoreApplication::applicationDirPath();
    QCoreApplication::addLibraryPath(path);

    QApplication a(argc, argv);

    But I got the following error message:
    QCoreApplication::applicationDirPath: Please instantiate the QApplication object first

    That's all I got so far.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 plugin path problem

    You don't have to add applicationDirPath() to library paths --- it's already there. Just make sure that plugins are in proper subdirectories.

    Which plugins do you need?

  5. #5

    Default Re: Qt4 plugin path problem

    I need gif and jpeg plugins which are stored in \QTDIR\plugins\imageformat directory. Actually these plugins are called by QtCore4.dll, instead of my program. I want to put all these DLLs to the program folder when I deploy the application. Now, I have to change the hard-corded plugpath in QtCore4.dll and install the plugin dll into a fixed folder such as c:\qt4\plugins.

    My goal is to put plugin DLLs to the folder that stores my exe file. That's why I add applicatioon path to the LibraryPath.

    Thanks for your help:-)

    David

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 plugin path problem

    Quote Originally Posted by david.corinex View Post
    My goal is to put plugin DLLs to the folder that stores my exe file.
    If xxx is one of the "library" paths, Qt will look for image plugins in xxx/imageformats subdirectory.

    What does QCoreApplication::libraryPaths() return on your system?

  7. #7

    Default Re: Qt4 plugin path problem

    Oh my....

    I forgot QtCore4.dll will search plugins in /newpathdir/imageformats directory. I will try this today:-)

    Thanks for your great hints!
    David

Similar Threads

  1. problem with plugin mysql
    By jose.va18 in forum Installation and Deployment
    Replies: 2
    Last Post: 19th September 2007, 12:12
  2. Qt 4.3.1 Windows Svg plugin problem
    By tzioboro in forum Installation and Deployment
    Replies: 7
    Last Post: 14th September 2007, 10:37
  3. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  4. plugin loading problem
    By naresh in forum Qt Programming
    Replies: 6
    Last Post: 9th June 2007, 19:05
  5. QPSQL plugin problem
    By tuxi in forum Qt Programming
    Replies: 0
    Last Post: 12th March 2007, 20:44

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.