Chinaunix首页 | 论坛 | 博客
  • 博客访问: 409804
  • 博文数量: 117
  • 博客积分: 5235
  • 博客等级: 大校
  • 技术积分: 1775
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-12 15:51
文章分类

全部博文(117)

文章存档

2012年(9)

2011年(2)

2010年(21)

2009年(13)

2008年(72)

我的朋友

分类: C/C++

2012-02-28 15:39:13

What:
  QT resource. Package all binary resources into process to instead of the directory style. Then you can use all these resources like below:
  cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
 
How:
  Two method to use:
  1. .qrc file
  1. <!DOCTYPE RCC>
  2. <RCC version="1.0">
  3.  <qresource>
  4.      <file>images/copy.png</file>
  5.      <file>images/cut.png</file>
  6.      <file>images/new.png</file>
  7.      <file>images/open.png</file>
  8.      <file>images/paste.png</file>
  9.      <file>images/save.png</file>
  10.  </qresource>
  11.  </RCC>

Set up in .pro file:

RESOURCES = application.qrc

Init in application source code(optional):

Q_INIT_RESOURCE(graphlib);

  2. .rcc file, binary package

rcc -binary myresource.qrc -o myresource.rcc

Register in application source code:

QResource::registerResource("/path/to/myresource.rcc");
阅读(1701) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~