Cool, thanks!

I've replaced it with a custom colour chooser from git already :)

cheers, Adam

On 07/02/2024 02:09, Mike Trahearn wrote:

Aha – you nailed it!

Yes, presently the Qt Quick Dialogs do not style in the same way as the compile time styles do for the rest of Qt Quick Controls.

Unfortunately these are still using File Selectors under the hood to pull out the correct QML at run-time according to the style that is set.

Therefore it is necessary to include all styles’ QML files for the non-native dialog implementations whether you are going to use them or not – simply because there is no current way to let the compiler know this in advance.

Qt are aware of this and I understand that Mitch and Fabian have been working on something of a proper solution which may help in the long run:

https://codereview.qt-project.org/c/qt/qtdeclarative/+/476748 <https://urldefense.com/v3/__https:/codereview.qt-project.org/c/qt/qtdeclarative/*/476748__;Kw!!Nbma_1s!sJaDFZor5935rQPXkPofNIRMZdWXlSXnJx1ffjiblRUJvup2d01cv_MfJXd4EIVJlOlOaAC1DMyhXL8O-A$>

https://bugreports.qt.io/browse/QTBUG-120056

But for now, not much can be done about it.

Mike

*From: *Interest <interest-boun...@qt-project.org> on behalf of Adam <qt_inter...@xibo.at>
*Date: *Wednesday, 7 February 2024 at 4:31 am
*To: *interest@qt-project.org <interest@qt-project.org>
*Subject: *Re: [Interest] unnecessary files in qrc system in webassembly

Hi,

so I tracked it down to the import of QtQuick.Dialogs. When I import it, the size of the wasm file increases from iirc 34mb to 40, and my debug output shows the fusion and imagine style (plus some others). It makes sense as there are a bunch of native dialogs in there. though i don't know whether they are usable via wasm. In case somebody is finds this, do a full rebuild after removing dialogs. Seems like caching is at work there.

I don't know whether this is a bug or not. These styles don't show in native compilation on linux. and it's certainly surprising, that adding a colour dialogue adds 6mb on your wasm file.

should i report it as a bug?

thanks for the answer, it helped understanding the issue :)

cheers, Adam

On 04/02/2024 17:35, Adam wrote:

    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
    
<https://urldefense.com/v3/__https:/github.com/adam-ce/alpine_renderer/blob/main/app/CMakeLists.txt__;!!Nbma_1s!rrg6SQO0VebmrkHkCIbpQgK3ju5OecGxvICtkCkGOnnpK3EhS0bKV8AzkCdgAryMH7mqv3zZhfh78Gil1rNp9g$>
    with automatic builds at
    https://adam-ce.github.io/alpine_renderer/wasm_singlethread/alpineapp.html
    
<https://urldefense.com/v3/__https:/adam-ce.github.io/alpine_renderer/wasm_singlethread/alpineapp.html__;!!Nbma_1s!rrg6SQO0VebmrkHkCIbpQgK3ju5OecGxvICtkCkGOnnpK3EhS0bKV8AzkCdgAryMH7mqv3zZhfh78GjBgsCSoQ$>

    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>
        <mailto:interest-boun...@qt-project.org> on behalf of Adam
        <qt_inter...@xibo.at> <mailto:qt_inter...@xibo.at>
        *Sent:* Saturday, February 3, 2024 1:19:35 AM
        *To:* interest@qt-project.org <interest@qt-project.org>
        <mailto: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$
        
<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  
<https://urldefense.com/v3/__https:/lists.qt-project.org/listinfo/interest__;!!Nbma_1s!rrg6SQO0VebmrkHkCIbpQgK3ju5OecGxvICtkCkGOnnpK3EhS0bKV8AzkCdgAryMH7mqv3zZhfh78GiJHCHFZQ$>
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to