In the 4.8 docs, it is specified that:
When using files with relative paths, the path should be relative to the file whereQt.createComponent() is executed.
So I use the following to create an object:
Qt.createComponent("./foo/bar.qml").createObject(_this)
But I get the error:
QQmlComponent: Component is not ready
I have also tried (without luck) "foo/bar.qml"
. Changing to "foobar.qml"
works fine, with the directory structure:
./
+--foo/
| `--bar.qml
`--foobar.qml
I notice however that there is no mention of relative URLs in the version 5 docs, so is there a new way to do this that I'm missing?