PDA

View Full Version : Add files to resources dynamically



juracist
25th June 2014, 11:37
Is it possible to add files to existing resources (.qrc) file, but dynamically, from C++ code?

I already created images.qrc and put some image files in it. Now i want to load some objects during the app execution time, and add images from loaded objects' filepaths to existing resource file.

stampede
25th June 2014, 12:24
Resource files (.qrc) are used by rcc tool to create .cpp source code, which is then compiled into the executable. In order to add new file to resource system you have to recompile the project.

add images from loaded objects' filepaths to existing resource file.
Can you explain what is your goal, why can't you just load the image via QImage/QPixmap class interface ? You want to put the image into resource system in order to use it later, right ? So why can't you just use it with QImage::load etc. methods ?

juracist
25th June 2014, 15:29
Thanks, I just loaded it via QPixmap and it works great!