.rcc file not found when trying to call registerSource

做~自己de王妃 提交于 2019-12-24 12:50:43

问题


I have generated a .rcc file using the following command:

rcc -binary redTheme/redTheme.qrc -o redTheme.rcc

I then put the redTheme.rcc file into the binary folder. Finally, I register the file with registerResource(const QString & rccFileName, const QString & mapRoot = QString()):

QResource::registerResource("redTheme.rcc")

The method returns false. Do I need to set a path or something similar?

Note that I'm using MSVC 2013 with CMake. According to this post, it could be a problem.


回答1:


You might need to pass an absolute path. For example:

QResource::registerResource(QCoreApplication::applicationDirPath() + "/redTheme.rcc");

One way to confirm this is to check if the following statement returns true:

QFile::exists("redTheme.rcc")


来源:https://stackoverflow.com/questions/35870871/rcc-file-not-found-when-trying-to-call-registersource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!