Qt does not load JPG , just PNG
Asked Answered
O

1

5

I work with my colleagues on the same project on Windows 7 64 bit version, Visual Studio 2008.

They load JPG and they work. Through QPixmap and Stylesheets. And works. But for me, i can only work with PNG, the rest don´t work at all.

I also tried to change paths on the environment variables, but i only see one Qt path (the bin) on it. Nothing about plugins, i guess... as i read on the documentation:

"By default, Qt can read the following formats: Format Description BMP Windows Bitmap GIF Graphic Interchange Format (optional) JPG Joint Photographic Experts Group JPEG Joint Photographic Experts Group MNG Multiple-image Network Graphics PNG Portable Network Graphics PBM Portable Bitmap PGM Portable Graymap (...)"

I wonder what does "optional" means?.

Outman answered 14/2, 2013 at 15:49 Comment(4)
When i wrote the post nothing showed up in the help. Sorry for that. . Is GIF related to JPEG?. That way, should i install some kind of extension to Qt to add jpeg support?. Because i don´t have any QT dirs on path except the Bin. So the path fix doesn´t work, and the imageformats/ folder is not what i have.Outman
Furthermore, my problem happens not in both Debug and Release.Outman
You need to have a folder called "imageformats" with the relevant Qt DLLs placed next to your binary.Brooklynese
Related, with good advice: #7153097Chrisoula
P
10

Your executable is missing the jpg plugin. Optional means, that if your executable doesn't find the plugins (dlls) it will start, but without loading these image formats. It is the same with a lot of qt features (fe: slqdrivers)

You will find the folder "imageformats" in C:\Qt\4.8.4\plugins (replace your installation dir and version), copy it to your executable path and it will show jpgs.

Probably, some environmental variables of your colleagues differ a bit from yours.

Take care with Qt plugins and the distribution of your application.

Pyrogallol answered 17/2, 2013 at 10:41 Comment(4)
I have a folder with all those dlls with jpeg and gif libraries. C:\qt-4.7.3\plugins\imageformats ... But you tell me to copy the dlls to my debug and release folders?Outman
Copy the folder "imageformats" to your executable folder. For example: C:\MyApp\MyExe.exe , C:\MyApp\imageformats. Or you can also set some enviromental variables. Take a look at doc.qt.digia.com/stable/deployment-plugins.html for details.Pyrogallol
How come my other colleagues don´t need that?Outman
Did you read the link? It is all there. In any case, they will need to copy this folder if they want to deploy the application to anyone who doesn't have qt installed.Pyrogallol

© 2022 - 2024 — McMap. All rights reserved.