Hi,

I'm using Qt 6.6.1 and cmake.

I have imports like this:

import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import QtQuick.Dialogs

at one point i'm also importing QtQuick.Controls.Universal.

i also verified that at no point i'm importing QtQuick.Controls alone. i'm linking in CMakeLists.txt via: target_link_libraries(alpineapp PUBLIC nucleus gl_engine Qt::Quick Qt::QuickControls2 Qt::Charts) // Charts removed on my other workstation with no change.

this is the CMakeLists.txt i'm using (along with the rest of the project: https://github.com/adam-ce/alpine_renderer/blob/main/app/CMakeLists.txt with automatic builds at https://adam-ce.github.io/alpine_renderer/wasm_singlethread/alpineapp.html

interestingly, on a desktop build, only commonstyle and macstyle are imported (no material style, but it's there in the app).

I also just tried the calqlatr example, replacing the only import of QtQuick.Controls i found with QtQuick.Controls.Material and adding my debug code for printing styles. The result is import of the imagine, basic and fusion style, but surprisingly not material.

I'll try to setup a minimal example on tomorrow.

Thanks, Adam

On 02/02/2024 18:29, Mike Trahearn wrote:
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-boun...@qt-project.org> on behalf of Adam <qt_inter...@xibo.at>
*Sent:* Saturday, February 3, 2024 1:19:35 AM
*To:* interest@qt-project.org <interest@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@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.   ­­
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to