QML / Cpp plugin
-
Thanks for replying.
I actually already tested to add import path to my view engine :
@ m_view->engine()->addImportPath(QLatin1String("file:///C:/HMI/qmlcomponents/test_plugin/release"));
qDebug() << m_view->engine()->importPathList();@and the dump of the import path list is ok, there is the path to where the qmldir / plugins.qmltypes / dll file are.
Unfortunately, nothing changed...
-
The "no code in the docs" is a bug in the docs - code snippets aren't being generated by qdoc correctly, and I don't know why. I've asked Jerome about it on IRC and he said he'd look into it.
Regarding your module:
http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qtqml-modules-identifiedmodules.html explains that you must install to QML2_IMPORT_PATH for QML2/QtQuick2 plugins (where you seem to use QT_INSTALL_IMPORTS in your project) - by default I think this is /usr/lib/qt5/qml on Linux, so your particular module would be installed to /usr/lib/qt5/qml/com/mycompany/components on Linux. You're on Windows, I see, but I don't know what the default import path for QML2 modules is on that platform.If addImportPath() isn't working as specified, that's a bug - please file a bug report and assign it to Alan Alpert. There are unit tests for that functionality, however, so either you've got a strange environment, or something strange is going on.
See http://doc-snapshot.qt-project.org/qt5-stable/qtdoc/qtquick-debugging.html#debugging-module-imports for more information about debugging imports. QML_IMPORT_TRACE=1 ./myapp should tell you a bit more about what's going on.
Cheers,
Chris. -
Ok.
Basically, what is working is copy/paste the plugin (ie. the dynamic lib, the plugins.qmltypes and the qmldir) into the Windows default qml directory... So the normal behaviour of the
(Which is fyi : C:/Qt/Qt5.0.2/5.0.2/qml)
QT_INSTALL_IMPORT seems to be used only with the "unix" tag on the project file. As i'm not compiling for Unix, the "QML_IMPORT_PATH" should add to the import path the correct place.
The addImportPath() add the correct path to the Import path but... it still prompts me that my plugin is "not installed".
How do you make a bug report ?
-
Not QML_IMPORT_PATH. QML2_IMPORT_PATH. When the version was bumped, the import path env var changed.
But you're right, the addImportPath() should also add the path.
Make a bug report on bugreports.qt-project.orgCheers,
Chris. -
Hey, thanks for your reply.
I've actually "QML_IMPORT_PATH" in my project file 'cause QML2_IMPORT_PATH doesn't seems to exists. With QML_IMPORT_PATH, qtcreator seems to see my lib (but still it prompts that it's not installed) and with QML2_IMPORT_PATH, it doesn't seems to see my lib (Warning on the qml file, import fail).
I'm writing a bug report.
-
QML_IMPORT_PATH might be what QtCreator uses to determine typenames and so forth, I don't know. But the QML engine uses QML2_IMPORT_PATH when it resolves plugins at runtime.