[SOLVED]can't open file from qresources
General and Desktop
23
Posts
4
Posters
10.9k
Views
3
Watching
-
hi,
so you could try to use an alias
<RCC> <qresource prefix="/plane"> <file alias="j3pipercub.obj">j3pipercub.obj</file> </qresource> </RCC>@mcosta Ok, the code that copies the content from file to file2 works. The new file on the filesystem has the correct content. So the bytearray is not full of zeros. But output via qDebug() doesn't work. The system's locale is English so this should work.
-
I'm Using Qt 6.5.2 and had the same issue and after an hour of digging and testing all your solutions i did some digging on the build folder and i saw this:
in <QBuild_Dir>/<cmake_project_name>/<module_name>_qml_module_dir_map.qrc
<RCC> <qresource prefix="/"> <file alias="/<<<cmake_project_name>>>"><<<QBuild_Dir>>>/<<<cmake_project_name>>></file> </qresource> </RCC>so there is an alias for the resource!
to use the resource on my C++ code i had to add it to the beginning of the resource path like
before: ":/assets/img.svg" after ":/<cmake_project_name>/assets/img.svgand it works 👌