How to specify path to qml file?
Solved
QML and Qt Quick
-
Hello citizens!
By default an app searches files in the build directory, so I have to writeQQuickView viewer; viewer.setSource(QUrl("../QML-graph/Main.qml"));
to load qml file. Is it OK to specify such "../" path or there is a better way to set the path?
In the Cmake I added qml files in this way:
qt_add_qml_module(appQML-graph URI QML-graph VERSION 1.0 QML_FILES "Main.qml" "serialport-view.qml"
-
After adding them with
qt_add_qml_module
they should all be available as resource:QQuickView viewer; viewer.setSource(QUrl("qrc:/QML-graph/Main.qml"));
-
A Atr0p0s has marked this topic as solved on