[SOLVED] Loading pure QML plugin from shared library and Qt Creator



  • I want some QML components (pure QML, no C++) to reside in Qt plugin library. QML files are embedded inside qrc, but then I got a trouble loading them as QML module.

    For example, I have some components in com.mycompany.coolcomponents module described in corresponding qmldir file. The path to qmldir is :/components/com/mycompany/coolcomponents/qmldir. I added this path to QML import paths:

    @
    m_declarativeContext->engine()->addImportPath(":/components");
    @

    But importing my module in QML doesn't work.

    @
    import com.mycompany.coolcomponents 1.0
    @

    I cannot figure out what I'm doing wrong, any ideas?

    Thanks in advance.

    UPDATE: The first problem is solved (removed plugin directive from qmldir), but now Qt Creator doesn't see my components' info (no autocomplete, etc), is there any way to make it parse QMLs from plugin?

    UPDATE 2: Fixed with QML_IMPORT_PATH variable.



  • This is little old post, but can you please give some code example how did you made it?

    I am having same problem, but I am unable to solve it yet...
    This is thread: "http://qt-project.org/forums/viewthread/27538/":http://qt-project.org/forums/viewthread/27538/


Log in to reply
 

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