相关疑难解决方法(0)

如何从共享库初始化Qt资源?

我无法弄清楚如何初始化Red Hat Enterprise Linux 5.2下共享库中声明和使用的Qt资源.

我在我的共享库中添加了一个Qt资源文件,添加了一个名为"resource"的前缀,并添加了一个文件"files/styleSheet.xsl".资源文件名为"resources.qrc".QFile :: exists返回false?

MySharedLib::MySharedLib()
{

   // I think Q_INIT_RESOURCE basically expands to this:
   // The resource file is named "resources.qrc"
   extern int qInitResources_resources();
   qInitResources_resources(); 

      QString resourcePath = ":/resource/files/styleSheet.xsl";
      if( false == QFile::exists(resourcePath))
      {
         printf("*** Error - Resource path not found : \"%s\"\n",   resourcePath.toLatin1().data());
      }

}
Run Code Online (Sandbox Code Playgroud)

提前感谢任何提示或建议,

resources qt shared-libraries

9
推荐指数
1
解决办法
5335
查看次数

标签 统计

qt ×1

resources ×1

shared-libraries ×1