Qt不加载JPG,仅加载PNG [英] Qt does not load JPG , just PNG

查看:664
本文介绍了Qt不加载JPG,仅加载PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与同事一起在Windows 7 64位版本Visual Studio 2008上的同一项目中工作.

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

他们加载JPG并且可以工作.通过QPixmap和样式表.和工程. 但是对我来说,我只能使用PNG,其余的根本不起作用.

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.

我也尝试更改环境变量的路径,但是我只看到一个Qt路径(bin).我想……与插件无关,正如我在文档中所读到的:

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:

默认情况下,Qt可以读取以下格式: 格式说明 BMP Windows位图 GIF图形交换格式(可选) JPG联合摄影专家组 JPEG联合图像专家组 MNG多图像网络图形 PNG便携式网络图形 PBM便携式位图 PGM便携式灰度图 (...)"

"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?.

推荐答案

您的可执行文件缺少jpg插件.可选的意思是,如果您的可执行文件没有找到插件(dll),它将启动,但不会加载这些图像格式.它与许多qt功能相同(例如:slqdrivers)

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)

您将在C:\ Qt \ 4.8.4 \ plugins(替换安装目录和版本)中找到文件夹"imageformats",将其复制到可执行路径中,并显示jpg.

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.

注意Qt插件和应用程序的分发.

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

这篇关于Qt不加载JPG,仅加载PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆