[SOLVED] Import directory in QML
-
Hello,
I've been reading the documentation on importing directories in QML: http://qt-project.org/doc/qt-5/qtqml-syntax-directoryimports.html
and what I am trying to do is not working.I have a QML file that imports an absolute path in another drive:
@import QtQuick 2.0
import "D:/My Documents/SametimeFileTransfers/importsTest/Level3/"Rectangle {
width: 800
height: 600
Text {
anchors.centerIn: parent
text: "Hello World"
}
MouseArea {
anchors.fill: parent
onClicked: {} } Cuadro{ id: yo color:"red" MouseArea { anchors.fill: parent onClicked: { yo.color="yellow"; yo.cambia("hola"); } } }
}
@According to the documentation, importing an absolute path is available but it's not working for me.
So I don't know if importing a directory in another drive will work. Right now I have the file "main.qml" located somewhere in drive C: and I would like to import a QML directory located in drive D:
If this is possible how can i handle this import?
Any comment regarding this issue is appreciated.
Thanks in advance.
-
This directory is outside the qml main files. Try to use QMLEngine.addImportPath(...) and qmldir to define the QML components.