QT————Q_INIT_RESOURCE
转载地址:http://blog.163.com/seven_7_one/blog/static/162606412201092713131191/
QT里的函数void Q_INIT_RESOURCE ( name )
Initializes the resources specified by the .qrc file with the specified base name. Normally, Qt resources are loaded automatically at startup. The Q_INIT_RESOURCE() macro is necessary on some platforms for resources stored in a static library
If the file name contains characters that cannot be part of a valid C++ function name (such as '-'), they have to be replaced by the underscore character ('_').
Note: This macro cannot be used in a namespace. It should be called from main(). If that is not possible, the following workaround can be used to init the resource myapp from the function MyNamespace::myFunction:
注意:这不是在一个命名空间中使用宏。应该调用的main()。如果这是不可能的,下面的解决方法可用于从函数初始化myNameSpace对象资源MyApp的::myFunction的:
例如,如果您的应用程序的资源在一个文件中列出的所谓myapp.qrc,您可以确保这些资源,在启动时初始化加入这一行main()函数:
nline void initMyResource() { Q_INIT_RESOURCE(myapp); }
namespace MyNamespace
{
...
void myFunction()
{
initMyResource();
}
}
posted on 2011-05-08 21:54 corecible 阅读(1398) 评论(0) 编辑 收藏 举报