Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QResource::registerResource failing
Qt 6.12 LTS is out! See what's new in the release blog

QResource::registerResource failing

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.1k Views 1 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by
    #1

    I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt "rcc" tool, but using version 5.15.3.

    The function QResource::registerResource() returns false using this file, which was compiled with the -binary command-line switch. After recompiling the same *.qrc file with the Windows rcc.exe of version 5.12.9, I could successfully load the file.

    With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.

    I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?

    R B 2 Replies Last reply
    0
    • R Robert Hairgrove

      I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt "rcc" tool, but using version 5.15.3.

      The function QResource::registerResource() returns false using this file, which was compiled with the -binary command-line switch. After recompiling the same *.qrc file with the Windows rcc.exe of version 5.12.9, I could successfully load the file.

      With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.

      I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?

      R Offline
      R Offline
      Robert Hairgrove
      wrote on last edited by
      #2

      Apparently, the older RCC files compiled on Windows are opened without any problems on the newer Linux Qt installation, so I will wait a few more days for more feedback and then mark this as "SOLVED"

      1 Reply Last reply
      0
      • R Robert Hairgrove

        I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt "rcc" tool, but using version 5.15.3.

        The function QResource::registerResource() returns false using this file, which was compiled with the -binary command-line switch. After recompiling the same *.qrc file with the Windows rcc.exe of version 5.12.9, I could successfully load the file.

        With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.

        I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?

        B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #3

        @Robert-Hairgrove I check the Qt source code of the rcc tool, apparently there does have new format from 5.12 to 5.15.
        https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp
        https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp
        The default format version of 5.12 is "2", and in 5.15 it is "3".
        According to the source code, version 3 adds Zstd as the new (and default) compression algorithm, while in old version there is only zlib.
        From the docs of 5.12 and 5.15:
        https://doc.qt.io/archives/qt-5.12/resources.html
        https://doc.qt.io/archives/qt-5.12/rcc.html
        https://doc.qt.io/qt-5/resources.html
        https://doc.qt.io/qt-5/rcc.html
        You can see in 5.15 new arguments are added to the rcc tool such as "--compress-algo" and "--format-version".
        So from my understanding 5.15 rcc should add --compress-algo zlib --format-version 2?
        Not tested though :) If that do not work then maybe they are just incompatible.

        [Added] found this in https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0

        • RCC now supports compressing content using the Zstandard
          (https://zstd.net) algorithm. Compared to zlib, it compresses better for
          the same CPU time, so this algorithm is the default. To go back to the
          previous algorithm, pass command-line option --compress-algo=zlib.

        So this change was added from 5.13

        R 1 Reply Last reply
        2
        • B Bonnie

          @Robert-Hairgrove I check the Qt source code of the rcc tool, apparently there does have new format from 5.12 to 5.15.
          https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp
          https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp
          The default format version of 5.12 is "2", and in 5.15 it is "3".
          According to the source code, version 3 adds Zstd as the new (and default) compression algorithm, while in old version there is only zlib.
          From the docs of 5.12 and 5.15:
          https://doc.qt.io/archives/qt-5.12/resources.html
          https://doc.qt.io/archives/qt-5.12/rcc.html
          https://doc.qt.io/qt-5/resources.html
          https://doc.qt.io/qt-5/rcc.html
          You can see in 5.15 new arguments are added to the rcc tool such as "--compress-algo" and "--format-version".
          So from my understanding 5.15 rcc should add --compress-algo zlib --format-version 2?
          Not tested though :) If that do not work then maybe they are just incompatible.

          [Added] found this in https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0

          • RCC now supports compressing content using the Zstandard
            (https://zstd.net) algorithm. Compared to zlib, it compresses better for
            the same CPU time, so this algorithm is the default. To go back to the
            previous algorithm, pass command-line option --compress-algo=zlib.

          So this change was added from 5.13

          R Offline
          R Offline
          Robert Hairgrove
          wrote on last edited by
          #4

          @Bonnie Thank you very much for your detailed reply. This was very helpful!

          1 Reply Last reply
          0
          • R Robert Hairgrove has marked this topic as solved on

          • Login

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