Eduard Rostomyan
Eduard Rostomyan

Reputation: 6546

QML error: qrc:/Main.qml:24 module "system" is not installed

I am new in QML and I have a project. In one of my directories I have /imports/system/qmldir file where I have he following code:

singleton System 1.0 System.qml
App 1.0 App.qml

and in my source file I have

import system 1.0

And the error says that module system is not installed.

qrc:/Main.qml:24 module "system" is not installed

Could you please tell me the steps or flow of installing the module.

Upvotes: 3

Views: 2354

Answers (1)

jpnurmi
jpnurmi

Reputation: 5836

You must call QQmlEngine::addImportPath() and pass the path to /imports.

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.addImportPath("/path/to/imports"); // <==
    engine.load(...);

    return app.exec();
}

Upvotes: 4

Related Questions