Hey guys
I want to insert a picture in an label
I used the following code
Qt Code:
To copy to clipboard, switch view to plain text mode
however when I run the program, everything displays except the picture.
Could you tell me how to fix this.
Hey guys
I want to insert a picture in an label
I used the following code
Qt Code:
To copy to clipboard, switch view to plain text mode
however when I run the program, everything displays except the picture.
Could you tell me how to fix this.
I guess that the picture isn't found. Please use a full path name to the picture and make sure that you (your program) has read access to the file. You can also have a look the resource system of qt for shipping images alongside your app.
cwnelatury (3rd June 2009)
that is absolutely not the problem.
I used pixmap before and the picture was there (not animated).
If you are sure that image is in same folder with executable, then it could be 2-3 problems.
1. Image is corrupt.
2. Your application is not finding the image formats plugins.
3. May be some problem with your GUI.
As with Lykurg and Yogeshgokul, I believe that cwnelatury's code should work if QT can find a valid Jpg.
It is probably creating a null pixmap and hence has has nothing to display.
AngiSad - how about some code to examine?
I am sorry I did a mistake and posted in the wrong thread.
My problem is how to insert an animated picture (GIF).
here is my thread:
http://www.qtcentre.org/threads/2720...Label-or-other
I'm having the same problem.
In QT Designer I have text in the QLabel, After I attempt to load the image the text disappears from the QLabel, but no image. I don't really want any text anyway.
1) How do you setup the plugin (I'm trying to show a jpg).
2) Is it ok to load the image from a qrc resource file.
Thanks
Brendan
Before going to deal with the plugin, make an example with an png file to see if your code works well. If so we see on...
To 2) Yes that is ok.
grantbj74 (17th March 2010)
Thanks
I got the png image working, I had to make sure the image was in the same folder as the executable.
After lots of toil and trouble I got the png image working with the resource file. I had trouble because I was using a make file instead of a project file. Probably not worth posting the results because its a bit of a mess with make files all over the shop.
Now I just need to get the jpeg image working. Probably easier to just convert to png, but would be interesting anyway.
Fine. You have to deliver the qipeg4.dll (or qjpegd4.dll if you build your application in debug mode) with your application. This file has to be in a folder relative to your executable named: imageformats. (Since I am not often on widnows, it also can be plugins/imageformats). Then your jpeg should be displayed.
See http://doc.trolltech.com/4.6/deploym...tml#qt-plugins for more informations.
Thanks,
Yeah I copied both dll's to the plugins\imageformats folder where the executable is. And no luck.
The collidingmice demo also had the same problem no cheese.jpg displayed. Maybe it doesn't like Windows XP like everyone else
I would have thought you would need to define it somewhere like sql (QT += sql).
what if you place imageformats directory in AppDirectory and not plugins ?
Does it works ?
No, I couldn't get that to work.![]()
debug where your application is looking for libraries. And then place the dll there.
Thanks for your help.
Don't worry about it i'll just use a PNG image.
I tried putting the dll into the same path as exe, and a library path (wasn't sure how to debug the library path info).
I'll just put this into the too hard basket. At least with PNG's, I don't need to supply the extra dll.![]()
Bookmarks