从Qt资源文件加载ico时出现问题 [英] Issue when loading an ico from a Qt resource file
问题描述
我使用Qt Designer 4.8.4,我在QMainWindow资源文件中包括两个文件:.ico文件和.gif文件。从代码加载时:
QPixmap p;
p.load(:/ MyApp / media / logo.gif); // does work
p.load(:/ MyApp / media / logo.ico); //不工作
gif文件工作,但不是ico文件。 有任何原因吗?我正在使用ico文件作为窗口图标,并且在运行应用程序时不显示。
,因为 GIF文件正在工作,所以我已成功编译qrc文件。
干杯,
默认情况下,Qt支持以下格式:
格式说明Qt的支持
BMP Windows位图读/写
GIF图像交换格式(可选)阅读
JPG联合图像专家组读/写
JPEG联合图像专家组读取/写入
PNG便携式网络图形读/写
PBM便携式位图读取
PGM便携式Graymap读取
PPM便携式Pixmap读取/写入
TIFF标记的图像文件格式读/写
XBM X11位图读/写
XPM X11 Pixmap读/
I am using Qt Designer 4.8.4 and I include two files in the QMainWindow resource file: a .ico file and a .gif file. When loading from code using:
QPixmap p;
p.load(":/MyApp/media/logo.gif"); // does work
p.load(":/MyApp/media/logo.ico"); // does not work
The gif file works, but not the ico file. Is there any reason? I am using the ico file as the window icon and it is not showing when running the application.
And, YES, I am successfully compiling the qrc file since the GIF file is working.
Cheers,
*.ico is not supported.
By default, Qt supports the following formats:
Format Description Qt's support
BMP Windows Bitmap Read/write
GIF Graphic Interchange Format (optional) Read
JPG Joint Photographic Experts Group Read/write
JPEG Joint Photographic Experts Group Read/write
PNG Portable Network Graphics Read/write
PBM Portable Bitmap Read
PGM Portable Graymap Read
PPM Portable Pixmap Read/write
TIFF Tagged Image File Format Read/write
XBM X11 Bitmap Read/write
XPM X11 Pixmap Read/write
这篇关于从Qt资源文件加载ico时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!