Extension Plugins



  • Hi, I restart a specific discussion about I read some partially answers as a collateral problem in other discussions I posted in the forums.

    I am experiencing that some components / elements like jpeg images are not shown in the release while works fine in the development environment.
    To be clear: under the Windows XP (and Windows 7 too) where I run (debug or release mode) the Qt-Quick application this works fine and loads correctly the jpeg images.

    Then using the Dependency Viewer I create a folder with all the dll and components needed to the application to run without Qt-SDK installed.

    When I run the application in this folder in a fresh installed machine (XP / W7) all workds, but jpeg images are not shown.

    Initially I thought to a sort of error or mismatch in the code, but it was so strange... Then I read in a post that some components, like svg files and jpeg uses extensions plugins (I think that are Qt standard plugins delivered with the SDK or Qt-Creator) that are linked/(called at runtime, so these can't be identified by Dependency viewer. How can I see what e-plugins are missed? Where I can find them? If the problem is this... But this possibility seems reasonably true.



  • The plugins can be found in the plugins subdirectory of your Qt tree. In my case, they are here: C:\Qt\2010.05\qt\plugins\imageformats

    You can distribute them like this:
    YourCoolApplication.exe
    QtCore4.dll
    QtGui4.dll
    ... (other needed libs)
    imageformats\qjeg4.dll
    imageformats\qgif4.dll
    ...

    the same goes for other plugins. You can use other locations, but make sure that they are in the plugin path that you supply using QCoreApplication::addLibraryPath().



  • I think, the question is: how do I know, which plugins are needed?

    For "normal" dll, you can ask Dependency viewer. But how do you know, which plug-ins are needed for your app?



  • I know of no automated way to determine that, but it really isn't that hard to come up with an answer:

    • For each type of image you use, you need the corresponding plugin.
    • For each type of database you wish to connect to, you need the corresponding plugin.
    • For each type of codec you wish to support, you need the corresponding plugin.
    • ...

    Basically: take a look at the types of plugins supplied in the folder I pointed out, and draw your conclusions. Every plugable subsystem in Qt needs the corresponding plugins to work properly, though you can build Qt in such as way that support is compiled in instead of supplied by a plugin (at least, for most of them, I think).



  • Andre and Gerolf, thank you very very much!!! You are saving a poor developer :)

    @Gerolf: I read in a post a couple of day ago, that you wrote about e-plugin... Now I searched in the doc and found the principle, but this is now very clear.

    @Andre: I see that is a good clear means that for every ... there is a plugin. Why there is a so poor documentation on Qt about program delivery? Ok, Then I think that if I have a database or image type etc, if a plugin is needed and almost what can be can be found on Qt documentation.

    I have already read somewhere that plugins need to be delivered in a "plugin" folder.

    bq. make sure that they are in the plugin path that you supply using QCoreApplication::addLibraryPath().

    How can I set the library path in a Qt-quick project? There is a QML equivalent or I addLibraryPath() in my main.cpp code?

    Many thanks.



  • Just put it in the main(), or use the default layout that I illustrated above. The documentation is not that poor, it is just that among all the other documentation, it is a bit hard to find. It is there though.



  • Thank you very much, Andre!

    The fact is that I am worried when ask things that seems stupid and is sufficient to search somewhere... As a matter of fact it's a bit difficult to find the documentation sometimes...



  • There is a wiki article "Dependencies in Qt":http://developer.qt.nokia.com/wiki/Qt_Library_Cross_Dependencies (formerly know as Qt Library Cross Dependencies). It shows you which other Qt libs are required by some Qt lib or plugin.

    Then you have the generic "deployment instructions":http://doc.qt.nokia.com/4.7/deployment.html and those for the specific platforms (eg. for "Windows":http://doc.qt.nokia.com/4.7/deployment-windows.html). The latter has a specific note about distribution "Qt plugins":http://doc.qt.nokia.com/4.7/deployment-windows.html#qt-plugins. And it also mentions the usage of QCoreApplication::addLibraryPath().

    I believe this docs are quite complete.



  • Hi Volker, always perfect and resolutive interventions, as usual :)

    As I wrote above, I found somewhere about QCoreApplication::addLibraryPath() and now I remember that was in the "deploying under windows document". It's quite complete, but what I had not clear (doc is complete but my understanding not sure...) was how to search and how to integrate the standard plugins. I understood that the described plugin usage was for program plugins (there is also a good example in the touch and pain)t, if I remember). So I don't thought that it may be also for Qt extended plugins.

    If I understood it means that some standard features of Qt are plugins just as those features that the developer can add to the application as specific plugins.

    Many thanks. The help of the forum members to disambiguate these things is really essential.



  • [quote author="Alicemirror" date="1300056182"]
    If I understood it means that some standard features of Qt are plugins just as those features that the developer can add to the application as specific plugins.
    [/quote]

    Yep, that's exactly the point. The standard set of features in plugins are:

    • Support for Accessibility: in dir accessible
    • Bearer management: in dir bearer
    • Text-Codecs (for en/decoding non-latin texts): in dir codecs, eg. qjpcodecs
    • Add-Ons for Qt Designer: in dir designer, eg. qt3support or phononwidgets
    • Graphics systems: in dir graphicssystems, eg. for OpenGL
    • Support for additional icon formats: in dir iconengines, eg. qsvgicons for SVG icons
    • Image formats: in dir imageformats, eg. qjpeg, qsvg, qtiff, qgif
    • Backends for Phonon: in dir phonon_backend
    • Tools for QML: in dir qmltooling
    • Drivers for SQL databases: in dir sqldrivers, eg. qsqlite (SQLite), qsqlmysl (MySQL), qsqlpsql (PostgreSQL)

    Be aware that some of the plugins require additional Qt libs. For example the qsvgicons plugin needs QtXml lib, as it is an XML based format. Some other plugin require the installation of additional non-Qt libs (eg. most of the SQL drivers). Those additional libraries need to go into the standard library path (on windows: the dir where the exe lives; on the mac: the Frameworks directory in the application bundle).



  • This explanation is Great!!! Thank Volker.

    If a terrestrial, mad but not yet mad scientist, where find this informations, also fragmented?

    Then I have a question about my misunderstandings. In plugins path I set the path where I deliver my plugins for the program release to the users, I suppose the obvious path should be "plugins".
    When I am in the Qt-Quick environment, I need also to put the plugins in my directory or they work because part of the IDE / Development environment ?

    Thank.



  • Uhm I don't remember where and when I soaked up that information. It's some years ago, when we had to ship the windows version of our application. Once you know it, you never forget it again :-)

    The path can be any arbitrary one, but "plugins" comes into mind instantly - and it is where the user would expect it :-)

    Regarding the QML plugins, I cannot give you any advice here, I have no experience with QML so far. But have a look at the Qt Quick form, I remember this being asked a couple of times.

    Ah, and in my previous post, I forgot to mention that you need a plugins base directory and the various types of the Qt plugins must reside in their respective subdirectory. A common directory layout would be:

    @
    AppDir
    +--MyFancyApp.exe
    +--QtCore4.dll
    +--QtGui4.dll
    +--PlugIns
    | +--imageformats
    | | +--qjpeg.dll
    | | +--qtiff.dll
    | +--sqldrivers
    | +--qsqlite.dll
    | +--qsqlmysql.dll
    +--mysql.dll
    @



  • THank you. Very good explanation. You saved a lot of my time :)



  • [quote author="Volker" date="1300060011"]
    @
    AppDir
    +--MyFancyApp.exe
    +--QtCore4.dll
    +--QtGui4.dll
    +--PlugIns
    | +--imageformats
    | | +--qjpeg.dll
    | | +--qtiff.dll
    | +--sqldrivers
    | +--qsqlite.dll
    | +--qsqlmysql.dll
    +--mysql.dll
    @

    [/quote]

    As far as I know, this layout is incorrect: the PlugIns directory doesn't belong there. Instead, the different plugin directories go directly into the application dir. At least, that is how I distribute my applications on windows, and that works.



  • As for I read and understood regarding paths and plugins distribution both these methods are valid. I can test not before today evening.



  • [quote author="Andre" date="1300082792"]
    As far as I know, this layout is incorrect: the PlugIns directory doesn't belong there. Instead, the different plugin directories go directly into the application dir. At least, that is how I distribute my applications on windows, and that works.
    [/quote]

    We have to ship some other plugins too, it would clutter the toplevel directory, so we decided to put it into that subdir. An we use the QCoreApplication::addLibraryPath()[1] approach, so it does not harm. With the default settings there is too much guessing where the plugins are located, we think this is the most robust way.

    fn1. use this for the path:
    @
    QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/PlugIns");
    @


Log in to reply
 

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