Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Multiple .qrc files in one application
Qt 6.11 is out! See what's new in the release blog

Multiple .qrc files in one application

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 9.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    supaiku_
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MartinH
      wrote on last edited by
      #2

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

      RESOURCES += qml.qrc \
      another.qrc
      

      I hope this will work :-)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        supaiku_
        wrote on last edited by
        #3

        Hi,

        No, that doesn't help.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          supaiku_
          wrote on last edited by supaiku_
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved