Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]can't open file from qresources
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]can't open file from qresources

Scheduled Pinned Locked Moved General and Desktop
ressource
23 Posts 4 Posters 9.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hamed
    wrote on 18 Apr 2015, 19:46 last edited by
    #21

    It didn't help either!

    HamedBabaeyan@yahoo.com
    for more interesting stuff

    1 Reply Last reply
    0
    • M mcosta
      18 Apr 2015, 19:37

      hi,

      so you could try to use an alias

      <RCC>
      <qresource prefix="/plane">
      <file alias="j3pipercub.obj">j3pipercub.obj</file>
      </qresource>
      </RCC>
      
      
      ? Offline
      ? Offline
      A Former User
      wrote on 18 Apr 2015, 19:53 last edited by
      #22

      @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.

      1 Reply Last reply
      1
      • E Offline
        E Offline
        Ebrahim Karimi
        wrote on 4 Sept 2023, 18:36 last edited by
        #23

        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 👌

        Standing on the shoulder of the giants

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved