Results 1 to 8 of 8

Thread: Qt 4.3.1 Windows Svg plugin problem

  1. #1
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Qt 4.3.1 Windows Svg plugin problem

    Hello
    I have following problem with Qt 4.3.1 on windows XP plaftorm.
    I am using svg module to draw icons on buttons from embedded resources.
    When I run program everything works ok. Svg modules are loaded correctly (plugins\iconengines\qsvg4.dll).
    But when I install program on other machine then plugin is not loaded.
    I have added proper path by

    QCoreApplication::addLibraryPath(QCoreApplication: :applicationDirPath()+QString("/plugins"));

    and copy plugin directory to the directory with app (as I always did when usiong for ex. sqlite plugin) but module is not loaded. Do I need to do enything extra to make Qt to use that plugin? Or maybe im missing something?


    Forgot to mention:
    I am using MinGw.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    Copy the plugin to iconengines subdirectory of the directory where the application binary is located.

  3. The following user says thank you to wysota for this useful post:

    tzioboro (14th September 2007)

  4. #3
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    Well it works ... it finds plugins in application directory as described in QCoreApplication::addLibraryPath. It is workaround, but It does not work if all plugin is copied to plugins directory and proper path is set.
    To be precise.
    App is testapp.exe and is in
    C:\Tmp\testapp.exe
    iconengine plugin is in
    C:\Tmp\plugins\iconengines\qsvg4.dll

    and QCoreApplication::addLibraryPath is added as mentioned in my previous message. Just after instanating QApplication.

    <code>
    QApplication app(argc, argv);
    QCoreApplication::addLibraryPath(QCoreApplication: :applicationDirPath()+QString("/plugins"));
    </code>


    So I am asking what went wrong?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    Quote Originally Posted by tzioboro View Post
    C:\Tmp\plugins\iconengines\qsvg4.dll
    Should be C:\Tmp\iconengines\qsvg4.dll. WIthout "plugins".

  6. #5
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    I think i found what was wrong.
    When I change plugins directory to anything else as test or plugin and move plugins to that directory and add this path to libraryPaths then it works.
    I think it is a bug.

  7. #6
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    But I want to have iconengines in plugins directory. So what should I do ?

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default

    Read my post above. The directory name (or path) where the "iconengines" directory is located doesn't matter. All that matters is the existance of "iconengines" directory in one of the directories in the library search path.

    Quote Originally Posted by tzioboro View Post
    But I want to have iconengines in plugins directory. So what should I do ?
    Short answer: you can't.

    Long answer: Take a look at QCoreApplication sources. Plugins are loaded from within there. Maybe you can load the plugin yourself from a custom location.

    Medium answer: compile the plugin statically into your application (see "static plugins" in the docs).

  9. #8
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.3.1 Windows Svg plugin problem

    Quote Originally Posted by wysota View Post
    Read my post above. The directory name (or path) where the "iconengines" directory is located doesn't matter. All that matters is the existance of "iconengines" directory in one of the directories in the library search path.



    Short answer: you can't.

    Long answer: Take a look at QCoreApplication sources. Plugins are loaded from within there. Maybe you can load the plugin yourself from a custom location.

    Medium answer: compile the plugin statically into your application (see "static plugins" in the docs).
    Ok I did read your post above. And I totaly agree with you. I was wondering why
    C:\Tmp\plugins\iconengines\qsvg4.dll
    could not be loaded when "custom" path is added this custom path is
    C:\Tmp\plugins
    by QCoreApplication::addLibraryPath(... +QString("\plugins");
    and it is working for anything else like
    C:\Tmp\plugin\iconengines\qsvg4.dll
    and QCoreApplication::addLibraryPath(... +QString("\plugin"); in code.

    I don't see in QCoreApplication code why custom path can not be in C:\Tmp\plugins.

    I know that it does not matter where iconengines is until it is in library search path - but it is in this path. I just wondering why it is not working. I am using this approach to have plugins in one direcotry (generaly for sqldrivers) in two other projects and it works.

Similar Threads

  1. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  2. plugin loading problem
    By naresh in forum Qt Programming
    Replies: 6
    Last Post: 9th June 2007, 19:05
  3. Qt Designer plugin on windows
    By big4mil in forum Newbie
    Replies: 4
    Last Post: 30th May 2007, 17:33
  4. QPSQL plugin problem
    By tuxi in forum Qt Programming
    Replies: 0
    Last Post: 12th March 2007, 20:44
  5. Application plugin on windows
    By Eyee in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2006, 17:36

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.