[Development] Using qml.exe with a custom QML_ELEMENT plugin

Elias Steurer kelteseth at googlemail.com
Tue Oct 24 19:23:37 CEST 2023


Hello devs,

This is a minimal example of a QML_ELEMENT plugin that I want to load 
via qml.exe. I can compile my plugin and QtCreator does recognize and 
autocomplete it. This project is based on the "Building a reusable QML 
module" documentation. See my attached example project:

  * C:/Code/Cpp/qml-plugin-minimal/CMakeLists.txt
  * C:/Code/Cpp/qml-plugin-minimal/Main.qml
  * C:/Code/Cpp/qml-plugin-minimal/Hello/World/CMakeLists.txt
  * C:/Code/Cpp/qml-plugin-minimal/Hello/World/Hello.h
  * C:/Code/Cpp/qml-plugin-minimal/Hello/World/Hello.cpp

Loading (tried with different import paths) does not work:

PS C:\Qt\6.7.0\msvc2019_64\bin> /.\qml.exe -I 
"C:\Code\Cpp\build-qml-plugin-minimal-Desktop_Qt_6_7_0_MSVC2019_64bit-Release" 
-f "C:\Code\Cpp\qml-plugin-minimal\Main.qml"
QQmlApplicationEngine failed to load component
file:///C:/Code/Cpp/qml-plugin-minimal/Main.qml:5:1: Die Bibliothek 
C:\Code\Cpp\build-qml-plugin-minimal-Desktop_Qt_6_7_0_MSVC2019_64bit-Release\Hello\World\Worldplugin.dll 
kann nicht geladen werden: Das angegebene Modul wurde nicht gefunden.
qml: Did not load any objects, exiting./

The Worldplugin.dll path is valid.

I also tried my other test project with the same isse. 
https://gitlab.com/kelteseth/qt6-cmake-qml-plugin-example-project

Any ideas?

Cheers,

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231024/13cc4dae/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qml-plugin-minimal.zip
Type: application/x-zip-compressed
Size: 2085 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231024/13cc4dae/attachment.bin>


More information about the Development mailing list