PDA

View Full Version : Qt-creator adding image problem



sageofsixpath
15th October 2014, 16:26
Hello,

I am trying to add image to my widget. I made a resource file and upload the image there. I can succesfully see the image as I want. But when I delete the original image file from folder QLabel becomes empty. How can i overcome this problem? I dont want the program file includes icon or image file.
Regards

d_stranz
16th October 2014, 03:44
Show the code where you load the image from the resource file.

Radek
16th October 2014, 09:52
Just guessing so that I can be wrong. You are running the app from the Qt Creator and you have deleted the image from the project resources. If it is so, Qt Creator will recompile your app and it finds no image.
As far as the project files are concerned, the image must be in the resources folder. The image gets really embedded in your executable and you do not need to distribute the image along with your app. Test:
(1) Return the image to the resources. Recompile.
(2) Copy the executable somewhere else. Run. You should see the image.
(3) Remove the image from the resources (temporarily). Run the copy you have made in (2). You should see the image.
(4) Return the image to the project resources, it belongs there. Recompile, because meddling with the resources made your executable (in the Qt Creator) invalid.

anda_skoa
16th October 2014, 09:53
But when I delete the original image file from folder QLabel becomes empty.
When you say you delete the original image, do you mean the image referenced by the resource file?
If yes, how do you expect the resource compiler to build it into the executable if it is not there anymore?

Cheers,
_