Problem with adding custom qml module
dominik_j last edited by
I am writing a QML-application, where a self written module needs to be imported and used. If I put my module in the locations provided in the QtQuick2ApplicationViewer viewer.engine()->importPathList(); everything works fine. Now I wanted to add the location where my module is located using the method viewer.addImportPath("/Users/userName/my/location/to/module");
If I call this method with the correct location my module is still not found. Even if I look directly afterwards at the list provided with the import paths, my path seems not to be added. Am I missing a step or doing something wrong?
chrisadams last edited by
Hrm, sounds like a bug. Ask aalpert on the #qt-labs channel on freenode irc.
You can run the application with QML_IMPORT_TRACE=1 set in your environment, to get more debugging output.
Spanken last edited by
I made my own qml module earlier today. What I did was to set the environment variable QML2_IMPORT_PATH to the absolute search path to my module folder.
It's important that you set a global environment variable. This because when running your qml from Qt Creator you don't seem to run it as your user.
I'm on a mac so I set it in the /etc/launchd.conf file as such
setenv QML2_IMPORT_PATH /path/to/your/module