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
    <RCC>
    <qresource prefix="/Test">
    <file>main.qml</file>
    </qresource>
    </RCC>

    and another.qrc looks like this

    <RCC>
    <qresource prefix="/Graphics">
    <file>MyBeautifulIcon.png</file>
    </qresource>
    </RCC>

    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 \
    another.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
    qrc:/MyFace.png

    I have to use the full name just as it is defined inside the qrc file.
    <file>assets/Subdirectory/MyFace.png</file>
    becomes
    qrc:/assets/Subdirectory/MyFace.png

    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.