Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

460 Topics 1.8k Posts
  • Receiving QNetworkReply::ProtocolFailure to GET request

    Solved
    2
    0 Votes
    2 Posts
    634 Views
    L
    The solution to the problem is to add the header res.addHeader("Access-Control-Allow-Origin", "*"); to the HTTP server; hServer.route("/", QHttpServerRequest::Method::Get, []() { QString testAnswer = "TEST REPLY"; res.addHeader("Access-Control-Allow-Origin", "*"); // Added line QHttpServerResponse res(testAnswer, QHttpServerResponse::StatusCode::Ok); return res; }); After adding this line, the browser forwarded the reply to my application.
  • How to Properly Exit a Qt WebAssembly Application?

    Unsolved
    1
    0 Votes
    1 Posts
    354 Views
    No one has replied
  • HttpsStatusCodeAttribute not working properly.

    Solved
    4
    0 Votes
    4 Posts
    945 Views
    L
    After some investigation, I don't believe the issue is related to the attribute method. The entire received reply is empty. There are no headers or body received by the application. The Wireshark capture shows that the entire message is properly sent out by my HTTP server and received by the browser, however, the application does not receive it. I checked if any error was reported by the reply and received an error QNetworkReply::ProtocolFailure (399). I believe the browser strips that information and does not propagate it further to the application. I tested this in Firefox and Chrome with the same results. As I mentioned in my original post, the communication works perfectly when compiled as a desktop application. The issue was only observed when compiled by WebAssembly. I will close this post and reopen a new one with a new question.
  • System cannot find specified file when building Web Assembly project in Qt

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    GilboonetG
    @lorn-potter Thank you, I think the OP needs help from someone who already built a Wasm project with Multimedia as he didn't manage to have his project built, on the pinned discussion almost all links are dead or out of date which doesn't help much.
  • Wasm apparently doesn't handle keyboard shortcuts

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    S
    I am having a similar issue too. In one of my views (mixed Qml and C++) I have a Node editor, where nodes can be added and connected. I used to handle the Keys.onPressed event and delete selected nodes and connection when Delete is pressed. This worked very well with Qt 6.6.1 in Webassembly (I use Linux). Now, when I switched to 6.8.1, Keys.onPressed event is never generated in Webassempbly (works well on desktop). My scene receives the active focus (I am logging onActiveFocusChanged) but not the keyboard events.
  • wasm-ld: error: initial memory too small, 87418256 bytes needed

    Unsolved
    1
    0 Votes
    1 Posts
    463 Views
    No one has replied
  • Errors usiong QNetworkInterface class in WebAssembly

    Solved
    5
    0 Votes
    5 Posts
    962 Views
    L
    @Mesrine Thank you again for your quick reply. I was so focused on the UI portion, that I didn't read the Networking section of the documentation properly. I need to investigate an alternative way to share data between the utility and the Remote UI. Thanks again for your help.
  • certificate error while installing emscripten

    Unsolved
    4
    0 Votes
    4 Posts
    694 Views
    SGaistS
    Likely a glitch Since it's working now, please mark the thread as solved :-)
  • Build RESTful API client example for WASM

    Unsolved
    3
    0 Votes
    3 Posts
    738 Views
    R
    Strange, I know for a fact that QNetworkAccessManager works on wasm, so you may want to use that instead.
  • How to use multi thread for Qt webassembly ? (Qt6.8.1)

    Unsolved
    1
    0 Votes
    1 Posts
    310 Views
    No one has replied
  • Unable to input Chinese (Chinese characters) ?

    Solved
    23
    0 Votes
    23 Posts
    7k Views
    J
    Confirmed:Qt6.8.1, it's finally possible to input Chinese. Thanks for all.
  • Qt for WebAssembly can play audio from url

    Unsolved
    2
    0 Votes
    2 Posts
    429 Views
    U
    AutoPlay and loops do not work in Qt 6.8.0/6.8.1. In 6.7.2, autoPlay is normal but there can only be one visible videooutput. Loops does not work either. In addition, your wasm must set the source externally, such as after clicking a button or "Component.onCompleted" . mediaPlayer.source = "xxx.mp3" Also, even if you only play audio, it seems that you need to set videoOutput, and since 6.7.3, there may be memory problems when using loader and mediaplayer. So it's better to avoid using mediaplayer.
  • How to call C++ methods from JavaScript ?

    Solved
    1
    0 Votes
    1 Posts
    259 Views
    No one has replied
  • wasm ui doesn't fit in browser window until resized

    Unsolved
    2
    0 Votes
    2 Posts
    642 Views
    P
    Hi, I have the same problem. Have developen a qt widget webasm application on qt 6.8 where the main annoyance right now is this problem. If browser windows is lesser than the default widget size it will not adjust to the browser window unless browser window is resized just so little it adjusts just fine to the size. It is like it fails to read the browser size when layout the main window.
  • How to implement svg output using QFileDialog.saveFileContent()

    Solved save svg
    7
    0 Votes
    7 Posts
    1k Views
    GilboonetG
    on 2 dec. 2024, I asked that question again and someone gave me an answer, see https://forum.qt.io/topic/159970/using-qsvggenerator-with-webassembly
  • Using QSvgGenerator with WebAssembly

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    GilboonetG
    @jsulm Thank you, I try that ASAP. It works fine either on Desktop and Wasm. Now I need to plug my data. void MainWindow::exporter() { QSvgGenerator SG; SG.setSize(QSize(200, 200)); SG.setViewBox(QRect(0, 0, 200, 200)); SG.setTitle(tr("SVG Generator Example Drawing")); SG.setDescription(tr("An SVG drawing created by the SVG Generator " "Example provided with Qt.")); QPainter painter; QBuffer buffer; SG.setOutputDevice(&buffer); painter.begin(&SG); painter.end(); QFileDialog::saveFileContent(buffer.data(), "myExport.svg"); }
  • default font doesn't render same size between desktop and Wasm

    Solved
    2
    0 Votes
    2 Posts
    574 Views
    GilboonetG
    By using tf = QFont("Bitstream Vera Sans", 8); tf.setLetterSpacing(QFont::AbsoluteSpacing, -1); I almost have the same rendering, except a small vertical offset that I can correct, My alignment formula is using an absolute value and I need to change it to relative.
  • QOpenGLWidget support on Win10/iOS

    Unsolved
    12
    1 Votes
    12 Posts
    2k Views
    Y
    @Birk-Skyum Thanks - this prompted me to try with the multithreaded Qt 6.8 version and (once I enable SharedArrayBuffer in Chrome) it solves the issue in Windows. Looks like I'll have to compile two versions for the forseeable future...)
  • This topic is deleted!

    Unsolved
    1
    1 Votes
    1 Posts
    36 Views
    No one has replied
  • ToolBar shortcuts only work when i move the TooBbar out of any dock site

    Unsolved
    3
    0 Votes
    3 Posts
    570 Views
    GilboonetG
    I amost got it, now I only need to press TAB after I clicked on a new color to be able to use keyboard shortcuts to rotate my 3d model. It breaks the working flow, but is usable. I'm using code (on the cellpress event handler of my TableWidget) to try to give the focus to my GraphicsView, but on WASM it doesn't seem to do anything. To be able to have the selected row showing the row color instead of its negative, I needed to add a label widget and add it to the first cell of the row, I added noTextInteraction to its TextInteractionFlags otherwise it has the focus when I click on it and handle keystrokes. Is there anything I can do ? is it possible to send a TAB keystroke at the end of my code so that the user doesn't need to do it ? ui->tableCouleurs->releaseKeyboard(); ui->vue3d->setFocus(Qt::OtherFocusReason); [image: 1f07cc19-95d1-456b-b5e1-355b106ffc90.png]