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. [SOLVED] Resources, Internal & External Use
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Resources, Internal & External Use

Scheduled Pinned Locked Moved General and Desktop
internal resourexternal resourmultiple resour
7 Posts 3 Posters 2.2k Views 3 Watching
  • 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.
  • R Offline
    R Offline
    RRRitchey
    wrote on last edited by RRRitchey
    #1

    I would like to use a set of internal resources and external resources at the same time. I have read and re-read the Qt Resource System document and the QResource class document and still don't really understand how to use the external resources and if I can use both an internal resource and an external resource at the same time. I could find no real examples of using external resources. I have the internal resources working and now want to add an external resource that changes depending on a user selected unit to work on. So I guess I have the following questions:

    1. Can use use both an internal and external resource at the same time?
    2. Do you need to instantiate a QResource object explicitly at any time?
    3. I have read where you call "QResource::registerResource("/path/to/myresource.rcc");" to register and external resource but then how do access a particular file in that resource?
    4. How are the internal and external resources distinguished from each other if they have similar paths?

    As I said, I just could not find any good examples to help me down this path. Thanks for any help resolving these questions.

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

      Hi,

      I can't try now but in theory:

      1. YES, you can use all kind of resources
      2. NO
      3. You can access a fie in the resource using the standard path :/<prefix>/<fiilename>
      4. If you need to distinguish you can use the second parameter in QResource::registerResource()

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Hi,

        1. Yes.
        2. No.
        3. You can specify the mount points (mapRoot) of your resources with
          bool QResource::​registerResource(const QString & rccFileName, const QString & mapRoot = QString()).
          All files (internal and external) are mounted under a common root dir and you access them by either qrc:///... or :/.
        4. You need to choose the mount points properly otherwise it won't work.
        1 Reply Last reply
        1
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @mcosta Haha, you were faster :-)

          1 Reply Last reply
          1
          • R Offline
            R Offline
            RRRitchey
            wrote on last edited by
            #5

            Thanks to both of you. I was really not sure what "mapRoot" was for some reason could not find an explanation using search. Let me try this and if it works I will mark as solved.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              RRRitchey
              wrote on last edited by RRRitchey
              #6

              Again, thanks to both of you. Your answered helped me understand the virtual resource path and also helped me understand how the "prefix" attribute in the qrc file is used. I have managed to get most of the way through using Qt using the documentation but the resource topic seems to me to be one that is minimally documented compared to other topics.

              ? 1 Reply Last reply
              0
              • R RRRitchey

                Again, thanks to both of you. Your answered helped me understand the virtual resource path and also helped me understand how the "prefix" attribute in the qrc file is used. I have managed to get most of the way through using Qt using the documentation but the resource topic seems to me to be one that is minimally documented compared to other topics.

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @RRRitchey You're welcome :-)

                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