[SOLVED]can't open file from qresources
General and Desktop
23
Posts
4
Posters
9.5k
Views
3
Watching
-
wrote on 18 Apr 2015, 19:46 last edited by
It didn't help either!
-
hi,
so you could try to use an alias
<RCC> <qresource prefix="/plane"> <file alias="j3pipercub.obj">j3pipercub.obj</file> </qresource> </RCC>
wrote on 18 Apr 2015, 19:53 last edited by@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.
-
wrote on 4 Sept 2023, 18:36 last edited by
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.svg
and it works 👌