QML included modules "not installed" unless qml directory is a subdirectory of the project file



  • I have a project with a structure like
    app/source/

    • all source and headers

    app/resource/

    • main.qrc
    • qml/main.qml

    app/project/

    With the app structured this way I am able to build but I get a blank white screen at runtime with errors about modules not being installed:
    W/Qt (28056): qrc:/qml/main.qml:47 ((null)): qrc:/qml/main.qml:47:1: module "QtPositioning" is not installed
    W/Qt (28056): qrc:/qml/main.qml:46 ((null)): qrc:/qml/main.qml:46:1: module "QtQuick.Layouts" is not installed
    W/Qt (28056): qrc:/qml/main.qml:43 ((null)): qrc:/qml/main.qml:43:1: module "QtQuick.Controls" is not installed
    W/Qt (28056): qrc:/qml/main.qml:42 ((null)): qrc:/qml/main.qml:42:1: module "QtQuick" is not installed

    If I move the resource directory to being a subdirectory of the project file it works:
    app/source/

    • all source and headers

    app/project/

    However, I wish to retain a separate directory for the resources. I've searched for flags to put in the project file to force it to find the modules but nothing seems to work. Any ideas how to accomplish this?

    Edit: Forgot to mention potentially relevant information. This is using Qt 5.4 for android target armeabi-v7a. Built and deployed using Qt Creator.



  • You need to set QML_ROOT_PATH in your .pro file to the path to the directory with your QML files. The default value is your project directory, that's why it works when you put your qml's right there.



  • [quote author="TheLivingOne" date="1421820531"]You need to set QML_ROOT_PATH in your .pro file to the path to the directory with your QML files. The default value is your project directory, that's why it works when you put your qml's right there.[/quote]

    This did the trick, thank you!


Log in to reply
 

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