Why does my QML Plugin fails to load when deployed, while it works inside the build dir?
-
wrote on 9 Mar 2023, 11:17 last edited by
Hello,
I have a QML plugin that is loaded at runtime.
If I run the app from the build dir, it works flawlessly.
If I do the same with the deployed application, it fails.The build dir is structured like that:
build\ MyApp.exe GUI\ Something\ Other\ GUI_SOMETHING_OTHERplugin.dll
While the deploy is generated by Qt's deploy script (CMAKE):
deploy\ bin\ <files deployed by qt deploy script> MyApp.exe qml\ GUI\ Something\ Other\ GUI_SOMETHING_OTHERplugin.dll <other files by qt>
When it starts, the engine import paths are the following:
- qrc:/
- <deploy-dir>/bin
- qrc:/qt-project.org/imports
- C:/Qt/6.4.2/msvc2019_64/qml
- <deploy-dir>/qml
The warning it gives is the following:
Warning: QQmlApplicationEngine failed to load component Warning: qrc:/MillManager/main.qml:7:1: Cannot load library <deploy-dir>\qml\GUI\Something\Other\GUI_SOMETHING_OTHERplugin.dll: The specified module could not be found.
It's strange, because the .dll exists! And it's in that path!
-
Hello,
I have a QML plugin that is loaded at runtime.
If I run the app from the build dir, it works flawlessly.
If I do the same with the deployed application, it fails.The build dir is structured like that:
build\ MyApp.exe GUI\ Something\ Other\ GUI_SOMETHING_OTHERplugin.dll
While the deploy is generated by Qt's deploy script (CMAKE):
deploy\ bin\ <files deployed by qt deploy script> MyApp.exe qml\ GUI\ Something\ Other\ GUI_SOMETHING_OTHERplugin.dll <other files by qt>
When it starts, the engine import paths are the following:
- qrc:/
- <deploy-dir>/bin
- qrc:/qt-project.org/imports
- C:/Qt/6.4.2/msvc2019_64/qml
- <deploy-dir>/qml
The warning it gives is the following:
Warning: QQmlApplicationEngine failed to load component Warning: qrc:/MillManager/main.qml:7:1: Cannot load library <deploy-dir>\qml\GUI\Something\Other\GUI_SOMETHING_OTHERplugin.dll: The specified module could not be found.
It's strange, because the .dll exists! And it's in that path!
May be your library depends on some other library. This may be missing in path.
-
May be your library depends on some other library. This may be missing in path.
wrote on 9 Mar 2023, 13:35 last edited by@dheerendra it's actually just 1 .qml file built with
qt_add_qml_module
, nothing else. -
@dheerendra it's actually just 1 .qml file built with
qt_add_qml_module
, nothing else.what is the import statement in main.qml ?
-
what is the import statement in main.qml ?
wrote on 10 Mar 2023, 08:20 last edited by@dheerendra I'm generating a QML file at runtime and load it with a Loader:
ListView { delegate: Loader { sourceComponent: Qt.createComponent(model.qmlFile) } }
The generated file is very simple:
import GUI.Something.Other GUI { }
1/5