<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QResource::registerResource failing]]></title><description><![CDATA[<p dir="auto">I am trying to load a <strong>binary</strong> 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 <code>"rcc"</code> tool, but using version 5.15.3.</p>
<p dir="auto">The function <code>QResource::registerResource()</code> returns <code>false</code> using this file, which was compiled with the <code>-binary</code> command-line switch. After recompiling the same <code>*.qrc</code> file with the Windows <code>rcc.exe</code> of version 5.12.9, I could successfully load the file.</p>
<p dir="auto">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.</p>
<p dir="auto">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?</p>
]]></description><link>https://forum.qt.io/topic/146031/qresource-registerresource-failing</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 11:49:39 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146031.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Jun 2023 07:38:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QResource::registerResource failing on Tue, 27 Jun 2023 09:35:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bonnie">@<bdi>Bonnie</bdi></a> Thank you very much for your detailed reply. This was very helpful!</p>
]]></description><link>https://forum.qt.io/post/762728</link><guid isPermaLink="true">https://forum.qt.io/post/762728</guid><dc:creator><![CDATA[Robert Hairgrove]]></dc:creator><pubDate>Tue, 27 Jun 2023 09:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to QResource::registerResource failing on Tue, 27 Jun 2023 08:44:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/robert-hairgrove">@<bdi>Robert-Hairgrove</bdi></a> I check the Qt source code of the rcc tool, apparently there does have new format from 5.12 to 5.15.<br />
<a href="https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp</a><br />
<a href="https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp</a><br />
The default format version of 5.12 is "2", and in 5.15 it is "3".<br />
According to the source code, version 3 adds Zstd as the new (and default) compression algorithm, while in old version there is only zlib.<br />
From the docs of 5.12 and 5.15:<br />
<a href="https://doc.qt.io/archives/qt-5.12/resources.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/archives/qt-5.12/resources.html</a><br />
<a href="https://doc.qt.io/archives/qt-5.12/rcc.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/archives/qt-5.12/rcc.html</a><br />
<a href="https://doc.qt.io/qt-5/resources.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/resources.html</a><br />
<a href="https://doc.qt.io/qt-5/rcc.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/rcc.html</a><br />
You can see in 5.15 new arguments are added to the rcc tool such as "--compress-algo" and "--format-version".<br />
So from my understanding 5.15 rcc should add <code>--compress-algo zlib --format-version 2</code>?<br />
Not tested though :) If that do not work then maybe they are just incompatible.</p>
<p dir="auto">[Added] found this in <a href="https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0</a></p>
<blockquote>
<ul>
<li>RCC now supports compressing content using the Zstandard<br />
(<a href="https://zstd.net" target="_blank" rel="noopener noreferrer nofollow ugc">https://zstd.net</a>) algorithm. Compared to zlib, it compresses better for<br />
the same CPU time, so this algorithm is the default. To go back to the<br />
previous algorithm, pass command-line option --compress-algo=zlib.</li>
</ul>
</blockquote>
<p dir="auto">So this change was added from 5.13</p>
]]></description><link>https://forum.qt.io/post/762717</link><guid isPermaLink="true">https://forum.qt.io/post/762717</guid><dc:creator><![CDATA[Bonnie]]></dc:creator><pubDate>Tue, 27 Jun 2023 08:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to QResource::registerResource failing on Tue, 27 Jun 2023 07:52:37 GMT]]></title><description><![CDATA[<p dir="auto">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"</p>
]]></description><link>https://forum.qt.io/post/762704</link><guid isPermaLink="true">https://forum.qt.io/post/762704</guid><dc:creator><![CDATA[Robert Hairgrove]]></dc:creator><pubDate>Tue, 27 Jun 2023 07:52:37 GMT</pubDate></item></channel></rss>