0

I'm working on Qt with CMake. Is it possible to import runtime QML files using CMake?

I wanto to creare a folder, near the .exe where I can put many QML files.

MyProject

  • CMakeLists.txt
  • main.cpp
  • main.qml test_comp myComponent
  • CMakeLists.txt
  • FirstComponent.qml
  • SecondComponent.qml

First CMakeLists.txt [...] add_subdirectory(test_comp/myComponent) [...]

MyComponent CMakeLists.txt qt_add_qml_module(myComponent URI test_comp.myComponent VERSION 1.0 PLUGIN_TARGET myComponent QML_FILES TabButton.qml )

With this solution Qt create .dll and .lib files. but If I want to modify my component.qml I need to rebuild to generate new dll. and .lib files.

Is there a way with CMake to make that qml component workable runtime for my app?

Thanks

  • qml is part of the resource file you should add `.qrc` file to your CMake. I didn't understand what is your problem, did you do this? – Parisa.H.R May 16 '22 at 08:46
  • Yeah but I want to load my qml file not from my .qrc, but from a path where .qml file is located. So at runtime is I make some chages to my qml I can simply re-run the app – Luca Olimpio May 16 '22 at 09:07

0 Answers0