Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Import of remote directory with qml files does not work

$
0
0
Hi, Your first import is a relative path import. When importing a local directory via relative import, the qmldir in the directory is treated as a directory listing file. Your second import is an absolute path import. Absolute path imports are treated as module imports unless you explicitly provide a qualified namespace (because directory listing qmldir files do not define a type namespace). Hence, the warning about no qmldir is because the qmldir in that path is not a module definition file (it’s a directory listing file) and you do not import the directory into a qualified namespace (using the ‘as’ syntax). Your third import should work, but you can ignore QtCreator’s “file or directory not found” error (because QtCreator will not access the remote URL and parse the qmldir file, so it doesn’t know which types are available or not). The error you get from Qt.createQmlObject() is because it has to load the content asynchronously via a socket. Don’t use Qt.createQmlObject() for this – instead, use Qt.createComponent() and then wait until the component’s status is Ready before you attempt to call the createObject() function provided by the component. Cheers, Chris.

Viewing all articles
Browse latest Browse all 4972

Trending Articles