Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

456 Topics 1.8k Posts
  • Warning: This file is not part of any project

    Unsolved 15 Sept 2022, 01:41
    0 Votes
    7 Posts
    2k Views
    @JoeCFD said in Warning: This file is not part of any project: INCLUDEPATH += $$PWD DEPENDPATH += $$PWD That didn't seem to work :/ I'll also note the issues that are coming up in QtCreator [image: 8a409062-1482-474c-8fd6-cdb7c57c52ae.png] My Emscripten version is 3.1.6, it just doesn't seem to recognize the version number [image: 68425b2d-2087-49d1-ad38-d47ceb1cf2d5.png] and I've tried with 3.0.0 and 1.39.7 with WebAssembly 5.15.2. This project is currently 6.3.2 but I can't get any WebAssembly to work
  • [Question] WebAssembly Dynamically URL Change

    Solved 6 Sept 2022, 04:13
    0 Votes
    5 Posts
    1k Views
    Qt WebAssembly uses emscripten, so technically you can call any Javascript from your C++ code using emscripten API. See https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code-call-javascript-from-native. Maybe that will help you change the query in the URL? At least the opposite - reading URL query from C++ code is possible. That I have tested. #include <emscripten/val.h> ... emscripten::val location = emscripten::val::global("location"); auto search = location["search"].as<std::string>(); For cross-platform code wrap the emscripten stuff in #ifdef Q_OS_WASM.
  • WebAssembly WebSocket client ignoreSslErrors

    Unsolved 16 Aug 2022, 09:55
    0 Votes
    2 Posts
    606 Views
    I researched the same thing and concluded it can't be done. The Qt WebSocket in WASM is a thin wrapper over the browser websocket support - same thing that can be used in Javascript. And that does not support ignoring SSL errors, see https://security.stackexchange.com/questions/211618/bypassing-valid-certificate-requirement-for-websockets/211636#211636. Only thing that does work, is to gain access to wss://IP:PORT, first open https://IP:PORT/index.html in your browser and manually make the user click "Proceed to IP (unsafe). After that you can open a websocket to same IP:PORT. [image: f09dea55-3a84-40e6-b861-02dc41040952.png] This is for me enough to test my app. In production should use a valid certificate. Another option for testing might be to use the qtwasmserver described in https://doc.qt.io/qt-6/wasm.html#running-applications but I personally have not tried it.
  • [Bugs] QT Webassembly

    Unsolved 12 Sept 2022, 06:39
    0 Votes
    3 Posts
    513 Views
    @jhayar If you want to report a bug use the Qt bug tracker: https://bugreports.qt.io/secure/Dashboard.jspa
  • 0 Votes
    2 Posts
    323 Views
    I have found the answer using emscripten , will mark this as solved
  • 0 Votes
    2 Posts
    597 Views
    @Pradson said in Unable to include 'Windows.h' in Qt WebAssembly project.: Please suggest how should I include Windows API into the WebAssembly project? I would assume you cannot, e.g. read https://github.com/emscripten-core/emsdk/issues/153 Emscripten is a cross-compiler, it compiles code to the web - it can't compile windows-specific code, as those APIs are not implemented on the web platform.
  • [Question] QT for WebAssembly

    Moved Unsolved 6 Sept 2022, 00:48
    0 Votes
    2 Posts
    493 Views
    Anyone ? I want to know what variable can we use in .pro in creating webapp ? when i check the documentation regarding the variables there's no webassembly on the docs . i need this to separate android,ios,windows,linux included path to webassembly includedpath , so i can use one project on all platform what i need to know in webassembly is What variable in .pro file to separate webapp to other project like , android{} , ios{} win{} is it wasm{}? or web{} ? or any other ? How can i call javascript method from QML ? or c++ ? What variable in .pro file that can add javascript file to my project What variable in .pro file that can add folders only for webassembly project ? Sometimes using qrc resource file is not needed to import qml custom control from other folders i try this on my self that i can use "/where/is/the/custom/control/path" as NameSpaceAlias on my other project without saving it into .qrc , but on the webassembly eventhough i define the file in .pro in DISTFILES, after compilation the files from distfiles are not included on the folder where compiled wasm located , so this gives me error
  • Does PySide supports WebAssembly?

    Unsolved 9 Sept 2022, 09:32
    0 Votes
    2 Posts
    2k Views
    @Pradson As of 2020 at least it does not look good: https://forum.qt.io/topic/119516/python-backend-qml-frontend-can-i-convert-to-webassembly @lorn-potter is the expert guy, he may see this and comment if there is any update....
  • 0 Votes
    2 Posts
    424 Views
    @Pradson said in Qt for WebAssembly package is not available with Qt/MSVC binaries.: VisualStudio_2017 compatible Qt5.15.10 You installed using Offline Installer, right? In that case you need to download offline installer for Qt for Web Assembly or use Qt Online Installer.
  • Qt 6.x WebAssembly + RemoteObjects

    Unsolved 5 Jul 2022, 19:20
    0 Votes
    4 Posts
    532 Views
    Actually, if you use QWebSockets (there is an example client wsclient in the QWebSockets examples) it can work without asyncify.
  • Virtual Keyboard behaviour in WebAssembly

    Unsolved 27 Jul 2022, 09:44
    0 Votes
    9 Posts
    1k Views
    @Renio I have not tried Qt6. In Qt5, I have to use qml for virtual keyboard display. In mobile(Android), native keyboard is used. On Linux, Qt keyboard is applied. No issues like yours. keyboard needs to be hidden when focus is false on a line edit or text input.
  • 0 Votes
    3 Posts
    787 Views
    Or you could fix it yourself if you happen to be running linux with GNU bash.. just make a new shell file ** WARNING ** may cause your Qt installation to have unexpected behavior as this is not a supported fix but merely a workaround to get the compiler to a state of being able to compile. fix_qt_paths.sh #!/bin/bash export QTPATH=/usr/local/qt/6.4.0/wasm_32 cd $QTPATH grep -rLi /home/qt/work | xargs -i@ sed -i \ s+/home/qt/work/qt/qtmultimedia/build/target+` echo $QTPATH`+g @ grep -rLi /home/qt/work | xargs -i@ sed -i \ s+/home/qt/work/qt/qtdeclarative/build/target+`echo $QTPATH`+g @ Obviously replace QTPATH with the path to the Qt installation you wish to modify. and voila all is working. This may be an incomplete fix as well.
  • Same issue on my side

    Unsolved 23 Jul 2022, 19:33
    0 Votes
    1 Posts
    258 Views
    No one has replied
  • Missing file wasm_shell.html

    Unsolved 11 Jul 2022, 14:19
    0 Votes
    1 Posts
    256 Views
    No one has replied
  • 0 Votes
    7 Posts
    1k Views
    @lorn-potter Hi, thanks a lot for sharing me detailed description. Currently, I am using Qt 5.12.3 and MSVC2017 for our product. If I migrated entire code from Qt 5.12.3 and MSVC2017 to Qt 6 and MSVC2019 then, could I replace MinGW with MSVC 2019 for web assembly related development? If yes, please share the steps for the same and if not, then suggest any other options. If I am in wrong path, then please suggest how shall I approach for our solution as well? Thanks, Pradson
  • 0 Votes
    4 Posts
    1k Views
    I solved! starting from a clean situation: I removed the source code using the Qt MaintenanceTool. I erased the dirty file contained in Src directory. I added the source code using the Qt MaintenanceTool. Now in a powershell in windows I ran this command .\configure.bat -qt-host-path C:\Qt\6.3.0\mingw_64\ -no-warnings-are-errors -platform wasm-emscripten -prefix %CD%\qtbase and followed the instruction in this post. [https://forum.qt.io/topic/136045/build-qt6-3-wasm-from-source-configure-error](link url) I appliated the patch indicated in this post. [https://bugreports.qt.io/browse/QTBUG-103498](link url) I ran the compile command cmake --build . --parallel. The last step, I most execute the installation of the wasm library patched, but I don have idea how
  • 0 Votes
    2 Posts
    289 Views
    qmake still works for apps!
  • Where to get the source for the examples?

    Unsolved 1 Jun 2022, 21:57
    0 Votes
    5 Posts
    630 Views
    @lorn-potter Are you saying I need to reconfigure and rebuild Qt? I did not build Qt initially. I just got it from the Linux install along with Qt Creator.
  • QSoundEffect for WebAssembly

    Unsolved 1 Jun 2022, 16:43
    0 Votes
    6 Posts
    816 Views
    Small correction, as others might face the same issue: in more complex application QAudioSink also fails to work (but works when compiled for Windows target). Based on the latest comment by Lorn in the corresponding bug report, Qt Multimedia for WebAssembly requires threaded build. I am trying to get this, will keep this thread posted when more results are available.
  • QWebSocket open not responding with error to invalid URL

    Unsolved 8 Jun 2022, 13:59
    0 Votes
    1 Posts
    254 Views
    No one has replied