Load qml file from outside of qml.qrc
-
I want to load a qml file ('main.qml') which resides outside of the qml.qrc resource. How do I do that?
Project structure:Resources qml.qrc / main.qml QML view.qml
main.qml:
import QtQuick 2.5 import QtQuick.Window 2.2 Window { visible: true Loader { id: loader source: "view.qml"; // qrc:/view.qml: File not found } }
Note: I already tried this: How to Locally Disable QRC in QML but it seams that 'baseUrl' is not set.
-
Hi @Chris_1981
Check if this help you. -
Thanks, p3c0, it works with the full path to the local file with file:/// in front!
source: "file:///C://Users//Admin//Documents//LoaderDemo//view.qml";
-
@Chris_1981 But the you will have to put this whole path string whereever your require the Components it contains. Instead do and
import
once and just use the Component.