Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

454 Topics 1.8k Posts
  • got my app running...

    Unsolved
    4
    0 Votes
    4 Posts
    459 Views
    MesrineM
    @mzimmers Normally, those files are distributed over the internet through a web server. Like: https://eddytheco.github.io/NftMinter/ Github uses a server to distribute those files to clients(browsers). But if your client downloads those files and serves them under his own server, it is the same. They can invoke the application locally in the same way you do when testing and developing. By running emrun, or with a python webserver, in general, using a web server. Some applications must use https(secure environment).
  • Error while running XaoS as a web application in Qt6

    Solved
    5
    1 Votes
    5 Posts
    825 Views
    Z
    After fixing the Emscripten version, this problem is solved.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Link error duplicate reference for VTK and QT when building for webasm: free type

    Unsolved
    1
    0 Votes
    1 Posts
    300 Views
    No one has replied
  • 0 Votes
    1 Posts
    450 Views
    No one has replied
  • Local IP Address

    Unsolved
    2
    0 Votes
    2 Posts
    349 Views
    No one has replied
  • Two major problem that prevent QT webassembly used in real project.

    Unsolved
    11
    0 Votes
    11 Posts
    3k Views
    Z
    @lorn.potter Hi, Is this issue very difficult to resolved? or not important? the new released versions all have this problem.
  • wasm project crashes after popup.close()

    Unsolved
    1
    0 Votes
    1 Posts
    219 Views
    No one has replied
  • writing to file

    Unsolved
    2
    0 Votes
    2 Posts
    334 Views
    jsulmJ
    @1XU7 said in writing to file: Is there another solution for this? According to "Local File Access" https://doc.qt.io/qt-6/wasm.html you can use IDBFS to store data persistently.
  • Virtual Keyboard and WebAssembly

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    S
    @brett-dalton Did you find a solution?
  • Application exit (ReferenceError: SharedArrayBuffer is not defined)

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    JasonWongJ
    You need to modify the http header. If you are using nginx deployment, you need to modify the conf file. This header needs to be modified: add_header 'Cross-Origin-Embedder-Policy' 'require-corp'; add_header 'Cross-Origin-Opener-Policy' 'same-origin';
  • What Qt Modules are Unsupported in web assembly

    Unsolved
    4
    0 Votes
    4 Posts
    390 Views
    JKSHJ
    @JonB said in What Qt Modules are Unsupported in web assembly: @jsulm Unsupported = (Supported & ~0xFFFFFFFF) ;-) What if it's a 64-bit enum that uses the MSB? ;-)
  • Full screen when working with opengl in wasm

    Unsolved
    1
    0 Votes
    1 Posts
    285 Views
    No one has replied
  • How to port Qt c++ desktop application with qwidget and qopenglwidget to qwebassembly ?

    Unsolved
    2
    0 Votes
    2 Posts
    311 Views
    jsulmJ
    @QtVik said in How to port Qt c++ desktop application with qwidget and qopenglwidget to qwebassembly ?: If yes could you please suggest me the steps to do that ? I'm not an WebAssembly expert, but the first thing you can try is to install Qt for WebAssembly build and run your app and see what happens.
  • Deploy WASM to Website (Squarespace)

    Unsolved
    2
    0 Votes
    2 Posts
    432 Views
    MesrineM
    @scimulate Hi, I am also not a web developer. The right answer depends on the Qt Javascript Api you are using. The general idea is you have a <div class="qtscreen" > </div> on your webpage. So, you have a div element of the class qtscreen(this depends on the Qt javascript API ), in this element the Qt application will be shown once you initialize the QtLoader. I created a javascript function to create the QtLoader and the different <div> elements on the webpage // initQTwasm provides API on top of QtLoader. The qtloader.js script has to be loaded before this. // // usage: // // app_name : name of the application // wasm_url : path to the app_name.wasm app_name.js app_name....js files // rootDivSele :name of the root div(html) where the app will be shown // logoPath : fullpath to a logo image to show when compiling wasm // function initQTwasm(wasm_url, app_name, rootDivSele, logoPath) { const rootDiv = document.querySelector(rootDivSele); const screen = "screen" + app_name; rootDiv.innerHTML += '<figure id="qtspinner"> <center > <img id="logo" crossorigin="anonymous" src="' + logoPath + '" ></img> <div id="qtstatus"></div> </center> </figure> <div class="qtscreen" id="'+ screen +'" ></div>'; const spinner = rootDiv.querySelector('#qtspinner'); const canvas = rootDiv.querySelector('#'+ screen); const status = rootDiv.querySelector('#qtstatus'); const logo = spinner.querySelector('#logo'); logo.style.cssText = String(logo.style.cssText); qtLoader = QtLoader({ path: wasm_url, restartMode: 'RestartOnCrash', restartType: 'RestartModule', canvasElements : [canvas], showLoader: function(loaderStatus) { spinner.style.display = (logoPath)?'block':'none'; canvas.style.display = 'none'; status.innerHTML = loaderStatus + "..."; }, showError: function(errorText) { status.innerHTML = errorText; spinner.style.display = (logoPath)?'block':'none'; canvas.style.display = 'none'; }, showExit: function() { status.innerHTML = "Application exit"; if (qtLoader.exitCode !== undefined) status.innerHTML += " with code " + qtLoader.exitCode; if (qtLoader.exitText !== undefined) status.innerHTML += " (" + qtLoader.exitText + ")"; spinner.style.display = (logoPath)?'block':'none'; canvas.style.display = 'none'; }, showCanvas: function() { spinner.style.display = 'none'; canvas.style.display = 'block'; }, }); qtLoader.loadEmscriptenModule(app_name); return qtLoader; } The produced qtloader.js when you compile to wasm "explains" how to do this. Also, you have to set the CSS styles of these HTML elements. An example here
  • emrun.py, getcwd() Operation not permitted

    Unsolved
    3
    0 Votes
    3 Posts
    534 Views
    C
    @SGaist Qt Creator does have access to that folder, but maybe the python shell it creates doesn't for some reason? If that is the case, I wonder how I can allow it. I can't change the python command it's running. I can only post on this forum every 10 minutes until I earn one reputation, what the heck
  • Style titlebar in QWidgets webassembly

    Solved
    2
    0 Votes
    2 Posts
    332 Views
    R
    Here is what I came with: #ifdef Q_OS_WASM #include <emscripten/emscripten.h> #endif #ifdef Q_OS_WASM const QString updatedCss = R"( .qt-window.has-frame { border: var(--border-width) solid #ebe9e9; border-radius: 10px; } .qt-window { background-color: #ebe9e9; } )"; const QString extendExistingCss = QString(R"( document.getElementById("screen").shadowRoot.querySelector("style").innerHTML += "%1"; )").arg(updatedCss.simplified()); emscripten_run_script(extendExistingCss.toLatin1()); #endif This one adds rounded corners and changes the border style color to something more pleasable (to me). This one is for the default theme but adjust as necessary for other themes. Seems to work nicely in all browsers.
  • CTRL + F in Qt for Webassembly page

    Unsolved
    1
    0 Votes
    1 Posts
    174 Views
    No one has replied
  • what's emscripten version for Qt 6.6 ?

    Unsolved
    4
    1 Votes
    4 Posts
    554 Views
    M
    @RandomGuy but its works when i removed SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -sAUDIO_WORKLET -sWASM_WORKERS")
  • QMessageBox::show problem

    Solved
    3
    0 Votes
    3 Posts
    409 Views
    R
    @sierdzio said in QMessageBox::show problem: @RandomGuy Please check/ report it on https://bugreports.qt.io/secure/Dashboard.jspa I looked there first. I will create a bug report. Edit: I have created this bug report: https://bugreports.qt.io/browse/QTBUG-116608