Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

452 Topics 1.8k Posts
QtWS25 Last Chance
  • 0 Votes
    1 Posts
    385 Views
    No one has replied
  • Local IP Address

    Unsolved
    2
    0 Votes
    2 Posts
    290 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
    191 Views
    No one has replied
  • writing to file

    Unsolved
    2
    0 Votes
    2 Posts
    263 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
    1k 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
    284 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
    233 Views
    No one has replied
  • How to port Qt c++ desktop application with qwidget and qopenglwidget to qwebassembly ?

    Unsolved
    2
    0 Votes
    2 Posts
    251 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
    358 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
    434 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
    259 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
    144 Views
    No one has replied
  • what's emscripten version for Qt 6.6 ?

    Unsolved
    4
    1 Votes
    4 Posts
    404 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
    341 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
  • Converting an Existing Project to a Web Application

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    R
    @SimonSchroeder I have been using it internally and it works really well. I went with the single thread approach (without async) as that seems to be the most supported version and for an application that behaves like a website I don't really need threads anyway. There are some things that we need to be careful like not calling code that breaks the Qt event loop like qdialog.exec(). There are also some things that don't work as expected but that I found workarounds for and bug reports have been opened, so they will be fixed in the next versions. https://doc.qt.io/qt-6/wasm.html Is a good place to start reading. Version 6.5.2 seems to work decently well and it will be good to start. You can also check the betas to see how bugs are getting fixed (in case you run into some issue with 6.5.2).
  • An easier to start license for singular developers / really small companies

    Unsolved
    10
    1 Votes
    10 Posts
    706 Views
    R
    @JonB I am not a lawyer but from my understading of GPL3, if the website is public (used by other people outside of the organization that owns it) the source code (for the frontend) must be made available in case of a request. Otherwise you will need a comercial Qt license to keep it private (and I am not sure if the acquired license from the developer will fulfil this when the developer delivers the website to the customer and the project ends). Edit: Nevermind, I am most likely wrong here, according to here: https://www.qt.io/faq/tag/qt-commercial-licensing "Can I continue to distribute my application after my developer license has expired?" It should be ok if the project ends, and the customer should be able to continue the website without licensing issues, well at least as long they don't modify the source with Qt tools.
  • export files to be uploaded later?

    Unsolved
    3
    0 Votes
    3 Posts
    230 Views
    1
    @SGaist nevermind!.. i got the way, i needed to copy *.js, *.wasm and *.html to my public_html folder .. thats all. thanks anyway.
  • Using qmake subprojects with WebAssembly

    Unsolved
    1
    0 Votes
    1 Posts
    187 Views
    No one has replied