简体   繁体   English

找不到qt资源qrc

[英]qt resources qrc not being found

I´m trying to load the following file: 我正在尝试加载以下文件:

<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/mike">
    <file alias="mike.json">mike.json</file>
</qresource>
</RCC>

with

QFile file(":/mike/mike.json");

But it does not work. 但这行不通。

So I moved 所以我感动

<qresource prefix="/mike">
    <file alias="mike.json">mike.json</file>
</qresource>

to another .qrc file. 到另一个.qrc文件。 Then it worked. 然后它起作用了。

Is there some way do debug in order to check if at least the prefix is being created? 有什么方法可以调试以检查是否至少已创建前缀?

I'm loading it from 我正在从中加载

SOURCES +=  \
    $$PWD/form.cpp 

HEADERS  += \
    $$PWD/form.h

RESOURCES = $$PWD/mike.qrc

and .cpp and .h files are available. 和.cpp和.h文件可用。 I do not understand why mike.qrc seems not being parsed. 我不明白为什么mike.qrc似乎没有被解析。

Is there some way do debug in order to check if at least the prefix is being created? 有什么方法可以调试以检查是否至少已创建前缀?

Method 1: Use GammaRay , it can show your resource tree. 方法1:使用GammaRay ,它可以显示您的资源树。

Method 2: In your app, use a recursive QDirIterator starting from :/ , and dump the file names as found. 方法2:在您的应用程序中,使用从:/开始的递归QDirIterator并转储找到的文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM