Loader wont find source when using several qrc files and relative paths
-
Hi,
i have an application with several qrc files.
main.cpp:
@
view.engine()->addImportPath( ":/" );
view.setSource(QUrl("qrc:/firstres/qml/main.qml"));
@
in main.qml is use components from another qrc file e.g. ComponentInSecondRes1, residing under qrc:/secondres/ComponentInSecondRes1.qml.
When this components use the Loader component and specifiy its source likes this
ComponentInSecondRes1:
@ Loader{
source: "ComponentInSecondRes2.qml"Component.onCompleted: { console.log(source.toString()) } }
@
I get this output:
Starting app.exe...
file:///execdir/:/secondres/ComponentInSecondRes2.qml.: File not found
file::/secondres/ComponentInSecondRes2.qmlA Loader in main.qml with source :/secondres/ComponentInSecondRes2.qml does work.
Also everything works fine when using full qrc:/... URLs. I dont want to do this, so i can use the some code for using qrc and not.
I tried initializing the other resources but this didnt help.
Did i miss something?Regards Stefan
-
Have you try with Qt.resolvedUrl( url url ) ?
http://qt-project.org/doc/qt-4.8/qml-qt.html#resolvedUrl-method -
yes, but it seems it has no effect
-
thanks this seems to work