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
- <!DOCTYPE RCC>
- <RCC version="1.0">
- <qresource>
- <file>images/copy.png</file>
- <file>images/cut.png</file>
- <file>images/new.png</file>
- <file>images/open.png</file>
- <file>images/paste.png</file>
- <file>images/save.png</file>
- </qresource>
- </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");
阅读(1740) | 评论(0) | 转发(0) |