how to specify new QML module in CMakeLists.txt?
-
Hi all -
I want to include some QML files from another project (this one). The author built it as a demo executable, and I don't need most of his code; I just want to use a few of his .qml files.
I've added this statement to my main.qml file:
import "CircularSlider"
I've also tried this:
import "../CircularSlider"
At runtime, I get an error "no such directory." Do I need to add something to my CMakeLists.txt file to make the directory visible to the program at runtime?
Thanks...
EDIT: I added this line into my qt_add_qml_module directive:
CircularSlider/controls/CircularSlider.qml
Seems to work OK now. Before I close this topic, though, I'd appreciate some feedback as to whether this is a good approach. As my project grows, should I just use the file system to group things, and create what will eventually become a rather large qt_add_qml_module() statement, or is there a preferred way? I notice the author of the code I'm using used a .qrc file for this purpose. I suppose this keeps the qmakelists.txt file compact; is that the primary benefit here?
-
This is right approach. You can refer