Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML Modules, Plugins and meta data



  • Hi,

    I wrote my own QML Module which is just a collection of different QML files. I work with CMake instead of QMake.

    If I add the plugin inside the App folder and set in the main.cpp

    qmlAppEngine.addImportPath("plugin")
    

    It does work.

    Since I want to use this module for different Apps, I moved it into another folder.

    qmlAppEngine.addImportPath("../../plugin")
    

    This leads to the error:

    plugin cannot be loaded for module  "FooPlugin": Failed to extract plugin meta data from "..../fooplugin.so"
    

    I had a look at this documentation https://doc.qt.io/qtcreator-extending/plugin-meta-data.html

    But it didn't help.
    So my questions are:
    Why does it work in this particular case?
    Where do I have to place the meta data json file?
    Did I forget to set some macros or similar?

    Is there another way to reuse the same qml files for different apps in the same project. Because at the beginning I tried to add to the .qrc file the relative paths to the external folder.

    Same issues as above. It works if the qml files are in the same folder as the app, doesn't work if the qml files are at an another place. After I searched for this problem, I found a forum post, that one should use modules to fix this issues....

    Maybe someone had already the same issues and solved them. I am happy for any suggestions


Log in to reply