Module not installed



  • Hi,

    I suffered catastrophic HD failure, with the loss of my project installation folder as the result. Not a huge problem, I compiled everything again, but now I can't get my project to run because it's unable to find my custom QML module. (I'm running Qt 5.7.1 on x64 Linux)

    This is my folder layout:

    /lemonade/bin/lemonade (this is the program binary)
    /lemonade/bin/org/lemonade/element/qmldir
    

    The qmldir file contains

    module org.lemonade.element
    ...
    

    ... with entries for every QML module.

    It used to work fine before (I restored the element folder with qmldir and all the .qml files from a recent backup), but whenever I run the project these errors are displayed in the console:

    "qrc:/LemonaDE/Panel.qml:1 module "Element" is not installed\n"

    I've tried setting the direct path to the folder containing the qmldir file using
    QQmlEngine::addImportPath("/lemonade/bin/org/lemonade/element") as well as a few other things, but I can't get it to work.

    What I would also like to fix is that QtCreator itself wasn't able to find the Element module (though my program could).

    Fairly sure this is a simple fix, anybody able to point me in the right direction?

    Thanks in advance!


  • Moderators

    @SQEW said in QML module not installed:

    QQmlEngine::addImportPath("/lemonade/bin/org/lemonade/element") as well as a few other things, but I can't get it to work.

    should be QQmlEngine::addImportPath("/lemonade/bin/");



  • @raven-worx

    Told you it was a simple fix! In fact, I tried this path before, but it still didn't work at first, because I used 'import Element 1.0' in my QML files. I've replaced that with 'import org.lemonade.element 1.0', and it works now, thanks!

    Just one more small question: QtCreator is still unable to recognize this path, as in, the editor underlines it red, and it is unable to use autocompletion as a result. Any idea how to fix that?


  • Moderators

    @SQEW said in QML module not installed:

    Just one more small question: QtCreator is still unable to recognize this path, as in, the editor underlines it red, and it is unable to use autocompletion as a result. Any idea how to fix that?

    no i don't know - but this doesn't mean there is a way. I also stumbled upon this, and i ended up copying my module to QT_INSTALL_DIR/qml folder.

    QtCreator probably has a setting somewhere to also set it's QML import path.



  • Hello @SQEW,

    I had the same problem on linux and I first used the solution @raven-worx proposed, then I ended up creating a script which

    export QML_IMPORT_PATH=/path/to/your/qml/
    export QML2_IMPORT_PATH=/path/to/your/qml/

    before launching qtcreator


Log in to reply
 

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