Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Deploying QML started by a main in a library to WebAssembly

Deploying QML started by a main in a library to WebAssembly

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 240 Views
  • 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.
  • A Offline
    A Offline
    Adam C
    wrote on last edited by Adam C
    #1

    Hi,
    in our application we are using the Catch2 unittesting framework. The framework itself runs fine on all platforms, printing its output to std out. In webassembly that is redirected to the javascript console. However, that is cumbersome to look at. I would prefer the output to just show in HTML (or on screen on android). In Qt 6.5 and earlier, the qtloader.js made it possible to redirect stdout and stderr, but that was lost in the 6.6 rewrite. So i thought, I'll capture the output in c++ and print it to a QML TextArea. That works in native, but not on webassembly (i did not yet test android). (pretty much minimal) code is here: https://github.com/AlpineMapsOrg/qml_catch2_console/tree/deployment_problem (note the branch, i deployed a workaround in main)

    The setup is a bit peculiar, because i have main.cpp with int main() {} and the QML startup code in a library. i then link that library into the unit tests. Catch2 machinery registers the tests from the unit test target. the unit test target itself doesn't have a main, but in cmake it is setup with qt_add_executable.

    However, in WebAssembly, it crashes, and on the javascript console i read:

    QQmlApplicationEngine failed to load component
    qrc:/qt/qml/src/qml_catch2_console/console.qml:19:1: module "QtQuick" plugin "qtquick2plugin" not found
    root window not created!
    

    The last one is coming from my main.cpp (it's just saying that the qml couldn't be started).

    Everything works when using the qml_catch2_console as a qt_add_executable (instead of a qt_add_library + unit test target). i printed all files packed using qrc, and i see, that the non-working version has fewer files in there (in particular no material controls). the same is true for the working native version.

    So the question is:
    How can i make this setup work for webassembly?

    Cheers, Adam

    1 Reply Last reply
    0

    • Login

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