Multiple .qrc files in one application

  • Hi,

    I have a general question about how multiple .qrc files work together.
    Let's say I have qml.qrc and another.qrc.
    In my project I can only reference to the content of qml.qrc, the another.qrc is simply not visible.
    My .pro file has

    RESOURCES += qml.qrc another.qrc

    The conent of qml.qrc is
    <qresource prefix="/Test">

    and another.qrc looks like this

    <qresource prefix="/Graphics">

    I have no clue why Qt only works with qml.qrc.

  • Hello :) I think that you need to write this instead of what you wrote :

    RESOURCES += qml.qrc \

    I hope this will work :-)

  • Hi,

    No, that doesn't help.

  • Okay, I figured out what was wrong.

    I used the wrong names to reference the files. I never assumed that the relative paths are part of the name
    as well.

    So instead of

    I have to use the full name just as it is defined inside the qrc file.

    This is one stupid mistake of me.

    Now, in order to make it work without having to use the fullnames I simply use a file alias.
    <file alias="MyFace.png">assets/Subdirectory/MyFace.png</file>
    and qrc:/MyFace.png works.

Log in to reply

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