3
votes

I'm trying to import the modules from papyros to my application. For that I cloned the repo, and then I added the modules path to the QML2_IMPORT_PATH env var.

The papyros is already with the qmldir files set correctly, so all I'd to do is to add the dirs to the QML2_IMPORT_PATH

i.e: If the qmldir is inside /myhome/qml-material/modules/Material dir, then I added the /myhome/qml-material/modules/Material to the QML2_IMPORT_PATH var.

I also tried to add using:

engine.addImportPath("/myhome/qml-material/modules/Material");

in the main.cpp just before load the main qml file.

Nothing seems to be working, I can't import the components inside my app and the Qt Creator code completion completely ignore the new dirs. I tried to add in several different ways:

import modules.Material.Action 0.1
import Material.Action 0.1
import Action 0.1

But I keep receiving the error: module "Module name" is not installed

The only way it works is using the full path:

import "/myhome/qml-material/modules/Material/Action.qml" as Action

But, of course, it's not what I want to.

Any idea how can I solve that?

1

1 Answers

3
votes

you should do engine.addImportPath("/myhome/qml-material/modules/"); not engine.addImportPath("/myhome/qml-material/modules/Material"); cause when you write import Material 0.1, Qt will search to a folder named Material, if you are already in it, this will not work.