问题
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