[SOLVED] Resources, Internal & External Use
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:
- Can use use both an internal and external resource at the same time?
- Do you need to instantiate a QResource object explicitly at any time?
- 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?
- 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.
I can't try now but in theory:
- YES, you can use all kind of resources
- You can access a fie in the resource using the standard path
- If you need to distinguish you can use the second parameter in
- 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
- You need to choose the mount points properly otherwise it won't work.
@mcosta Haha, you were faster :-)
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.
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.
@RRRitchey You're welcome :-)