I want to use Qt's resource system for my program. Visual Studio's resource system is giving me headaches while loading non text based files like .png, .bmp, .jpeg, etc. I have read a bit about Qt and it seems very interesting. I would like to use its resource system. I have downloaded the Qt Visual Studio Tool extension. I have also made a resource file containing the files that I would like to embed in the executable (NOT Qt's executable). I have made a Visual Studio Project, NOT a Qt Project. The only reason I installed the extension is to embed the resources in my executable and access them. Also, if possible I would like to include Qt's headers in my non-Qt Project, so I can easily register and read those resources. So, in a nutshell, this is what I want to do:
- Use Qt to embed my resources in the executable.
- Access those files in my program.
Something like this:
#include <Qtheaderfiles>
struct FileData {
unsigned char* bytes;
unsigned int size;
};
FileData loadFromResource(const std::string& res) {
QtFile file(res);
//get all the data from the file and return it in bytes.
return FileData { fileBytes, fileSize };
}
I expect the above code to compile even when there is no actual file in the directory "res", because all of the resources have been embedded into the executable.