[Interest] unnecessary files in qrc system in webassembly

Mike Trahearn mtrahearn at topcon.com
Fri Feb 2 18:29:16 CET 2024


Hi Adam,

How are you using the styles in QML?
Are you importing QtQuick.Controls (only) or are you using specific style imports?
Which version of Qt? CMake assumed?

Assuming the latter and at least Qt 6.2, CMake will only build in the libraries it absolutely needs. But for this to be the case, it needs to know what it needs. Using just import QtQuick.Controls relies on run-time style selection (for which there are different ways to select, all nicely documented). In this case the compiler cannot know in advance which to include, so it has to bring in all of them just in case you run post-build with a different style however it selects it.

For compile-time style selection, you import QtQuick.Controls.Basic/Fusion/Universal .... being specific. Or.. you can use your own style and not Qt Quick Controls at all (albeit it is sometimes hard to not use some of its nice helper types). In this case the compiler only compiles what it needs and there would be nothing in CMake that generates a qrc file with all the run-time style options.

Very obviously this is not your observation so more details on your Qt Quick Controls usage and how you choose your styles and any relevant CMake project/module info would be helpful for someone here to better understand your specific case and more importantly, if there might be a bug.

Mike

________________________________
From: Interest <interest-bounces at qt-project.org> on behalf of Adam <qt_interest at xibo.at>
Sent: Saturday, February 3, 2024 1:19:35 AM
To: interest at qt-project.org <interest at qt-project.org>
Subject: [Interest] unnecessary files in qrc system in webassembly

Hi,

I'm building a QML app for WebAssembly using CMake. When debugging
something else, I printed all files that are in the qrc system. Doing
that, I saw, that the macos, universal and fusion styles are all
compiled in. There are also a bunch of icons for file dialogues etc. I'm
not using them, and they increase the binary (wasm) size.

Is there any way to remove them?

Thanks, Adam
_______________________________________________
Interest mailing list
Interest at qt-project.org
https://urldefense.com/v3/__https://lists.qt-project.org/listinfo/interest__;!!Nbma_1s!q_zp_FnMrj7V43gyg_CdBBz6Br1KloWsNn1N5NtNXoQV-C6EsxxNRRAVLmKUbGLAfOkoCdgPaE6q65wqyhXoNg$
Confidentiality Notice: This message (including attachments) is a private communication solely for use of the intended recipient(s). If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this message. Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic Communication Privacy Act of 1986.   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240202/6dc1140e/attachment.htm>


More information about the Interest mailing list