Qt 6.12 LTS is out! See what's new in the release
blog
Add c++ model to qml
-
Hi,
I create c++ model as library and I want to add it to my qml app.
I have following project structure:A/ CMakeLists.txt - mylib/ - CMakeLists.txt - - model/ - - CMakeLists.txt - app/ - CMakeLists.txt - main.qmlSo I want to import class from model (A/mylib/model) to main.qml. I try use:
qt6_add_qml_module(model URI mylib.model VERSION 1.0 SOURCES someclass.h someclass.cc )In CMakeLists.txt in model dir.
And I import this to main.qml:import mylib.modelBut when I start problem I receive:
module "mylib.model" is not installedHow should I adopt my cmake files to work with this model in main.qml?