Import qrc:// doesn't work in QML-file



  • EDIT: Please delete this topic as the problem described here isn't a problem at all. It's something different.

    I store all imports I use in my main.qml-file in a qrc-file so they are embedded in the executable.
    However that import doesn't work like that:

    @import "../../desktop-components/components"@

    That would mean these files need to be present outside of the executable file (which I don't want because I don't like users tinkering with my components).

    What can I do to make this work?

    EDIT: main.qml also resides inside the resource-file

    @viewer.setSource(QUrl("qrc:/qml/MyProject/main.qml"));@

    Inside the resource-file are all the necessary components:

    @
    <file>qml/MyProject/main.qml</file>
    <file>desktop-components/components/Button.qml</file>
    <file>desktop-components/components/Button.qml</file>
    ....@

    According to this hint my example resource-file-entries should be fine:

    bq. Once this is done, all files specified by relative paths in QML will be loaded from the resource system instead. Use of the resource system is completely transparent to the QML layer; this means all QML code should refer to resource files using relative paths and should not use the qrc scheme. This scheme should only be used from C++ code for referring to resource files.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.