PDA

View Full Version : How to compile resources(bitmap,icon)



iGoo
19th July 2006, 07:04
Hi,guys:

I want to translate all the icons to binanry and load them when I need it.

I know qt supports two solutions for image resources,but I can not remember where I
ever see it.

Thanks.

jpn
19th July 2006, 08:06
The Qt Resource System (http://doc.trolltech.com/4.1/resources.html)

iGoo
21st July 2006, 03:13
:p Thank.

iGoo
21st July 2006, 03:48
I use qt4.1 and vs2003,here below is part of my vcproj file

<Filter
Name="Resource Files"
Filter="qrc;*"
UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
ParseFiles="FALSE">
<File
RelativePath="..\..\..\..\DlgTrigRec_bg.bmp">
</File>
<File
RelativePath=".\Resources\xx.bmp">
</File>
</Filter>

<File
RelativePath=".\xSysVer.ico">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Creating windows resources..."
CommandLine="rc.exe /fo &quot;xSysVer.res&quot; &quot;xSysVer.rc&quot;
"
Outputs="xSysVer.res"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description="Creating windows resources..."
CommandLine="rc.exe /fo &quot;xSysVer.res&quot; &quot;xSysVer.rc&quot;
"
Outputs="xSysVer.res"/>
</FileConfiguration>
</File>


how to modify it to compile my resources please?

I am confused by the project file that Vs2003 uses rc.exe or rcc(qt) to compile resource.

and I find that the qt logon icon was compiled and shown at the left corner of the widget's
caption.
How It does.




Thanks.

iGoo
21st July 2006, 04:24
I got it.


project xtest

1、把图片拷贝到resources文件夹下面去(或者随便一个文件)//copy images to a dir
2、新建一个xtest.qrc文件//new xtest.qrc
格式如下//format
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>resources/xx.bmp</file>
</qresource>
</RCC>
4、把该文件添加到工程里面的resources目录下(在vs界面上添加)//add xtext.qrc to project
5、右键点击该添加的文件,选择属性配置编译器:如下//configure compile tool
commandline: "$(QTDIR)\bin\rcc.exe" -o ".\GeneratedFiles\qrc_xtext.cpp" ".\xtest.qrc"
description: Run igoo configure rcc...

outputs: ".\GeneratedFiles\qrc_xtest.cpp"

dep : $(QTDIR)\bin\rcc.exe

Lele
21st July 2006, 09:56
Is this method suggested even for several large bmp used as background for application or it's slower than deploy the bmps as single files into the user pc?
thanks