PDA

View Full Version : QImage load() - Not finding updated image



Chris2oph
4th April 2014, 15:34
Hi

I am working on a linux Virtual Machine on Windows 8.

I have a UI which displays various different images, I have modified one of these image resources however when I run the program, the original image is still used. I have tried removing every single image from the folder that QT uses to load them from, in the hopes that this would at least stop any image being loaded, however once again the original images are used in each case, despite them not technically being in the folder that QImage's load method is using.

I believe that the resources may somehow be getting embedded into the executable (http://qt-project.org/doc/qt-4.8/resources.html), however I have no idea if this is the case or not.

My question is: How do I get QT to use the updated version of an image file?



// Setup the path to the image file
std :: string m_imagePath = ":/ErrorImages/NoImageExpected.png";

// Load the image file
m_image.load( m_imagePath.c_str() );

// At runtime, the original image is displayed every time - despite it being amended, and in a separate test case, removed completely

stampede
4th April 2014, 19:04
I believe that the resources may somehow be getting embedded into the executable (http://qt-project.org/doc/qt-4.8/resources.html), however I have no idea if this is the case or not.
So you don't know if you have created .qrc file and have "RESOURCES += file.qrc" entry in your .pro file ?
Anyway, file path structure looks like a path to embedded resource, so in order to make the change visible you need to update the resource file and rebuild the application.

Chris2oph
7th April 2014, 09:13
Many thanks for your response, I shall give this a try and hopefully it will help me resolve this issue :)