QT里的函数voidQ_INIT_RESOURCE ( name )
Initializesthe resources specified by the .qrc file with the specified basename. Normally, Qt resources are loaded automatically at startup.The Q_INIT_RESOURCE() macro is necessary on some platforms forresources stored in a static library
If the file name contains characters thatcannot be part of a valid C++ function name (such as '-'), theyhave to be replaced by the underscore character('_').
Note: This macro cannot be used in anamespace. It should be called from main(). If that is notpossible, the following workaround can be used to init the resourcemyapp from the functionMyNamespace::myFunction:
注意:这不是在一个命名空间中使用宏。应该调用的main()。如果这是不可能的,下面的解决方法可用于从函数初始化myNameSpace对象资源MyApp的::myFunction的:
例如,如果您的应用程序的资源在一个文件中列出的所谓myapp.qrc,您可以确保这些资源,在启动时初始化加入这一行main()函数:
nline void initMyResource() { Q_INIT_RESOURCE(myapp); }
namespace MyNamespace
{
...
void myFunction()
{
initMyResource();
}
}