Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

437 Topics 1.7k Posts
  • Links for Qt for WebAssembly

    Pinned Unsolved
    6
    7 Votes
    6 Posts
    3k Views
    S

    @tansgumus said in Links for Qt for WebAssembly:

    Fireofox 76.0 (64-bit)

    Fireofox 76.0 (64-bit) nooooooooooooooooooo this very bad

  • Build RESTful API client example for WASM

    Unsolved
    3
    0 Votes
    3 Posts
    86 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
    22 Views
    No one has replied
  • Unable to input Chinese (Chinese characters) ?

    Solved
    23
    0 Votes
    23 Posts
    3k 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
    88 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
    49 Views
    No one has replied
  • wasm ui doesn't fit in browser window until resized

    Unsolved
    2
    0 Votes
    2 Posts
    237 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.

  • 0 Votes
    7 Posts
    543 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
    192 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"); }
  • 0 Votes
    2 Posts
    75 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
    773 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
  • 0 Votes
    3 Posts
    124 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);

    Capture d'écran 2024-11-17 151222.png

  • How to install QtNetworkAuth for WebAssemby

    Unsolved
    8
    0 Votes
    8 Posts
    287 Views
    K

    I also tried with -DQT_DEBUG_FIND_PACKAGE=ON and the output is

    CMake Error at CMakeLists.txt:16 (find_package): Found package configuration file: /Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find required Qt component "BuildInternals". Expected Config file at "/Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfig.cmake" exists Configuring with --debug-find-pkg=Qt6BuildInternals might reveal details why the package was not found. find_package search path values and other context for the last package that was not found: CMAKE_MODULE_PATH: /Users/boyankiovtorov/emsdk/upstream/emscripten/cmake/Modules;/Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6;/Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6/3rdparty/extra-cmake-modules/find-modules;/Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6/3rdparty/kwin CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH}: CMAKE_FIND_ROOT_PATH: /Users/boyankiovtorov/emsdk/upstream/emscripten/cache/sysroot;/Users/boyankiovtorov/emsdk/upstream/emscripten/cache/sysroot;/Users/boyankiovtorov/emsdk/upstream/emscripten/cache/sysroot;/Users/boyankiovtorov/emsdk/upstream/emscripten/cache/sysroot;/Users/boyankiovtorov/emsdk/upstream/emscripten/cache/sysroot _qt_additional_packages_prefix_paths: _qt_additional_host_packages_prefix_paths: _qt_cmake_dir: /Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake QT_HOST_PATH: /Users/boyankiovtorov/Qt/6.8.0 Qt6HostInfo_DIR: /Users/boyankiovtorov/Qt/6.8.0/macos/lib/cmake/Qt6HostInfo Qt6_DIR: /Users/boyankiovtorov/Qt/6.8.0/wasm_singlethread/lib/cmake/Qt6 CMAKE_TOOLCHAIN_FILE: /Users/boyankiovtorov/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ONLY CMAKE_SYSROOT: $ENV{PATH}: /Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/opt/libiodbc/bin:/Users/boyankiovtorov/emsdk:/Users/boyankiovtorov/emsdk/upstream/emscripten:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Users/boyankiovtorov/Library/Application Support/JetBrains/Toolbox/scripts:/usr/local/mysql/bin
  • QColorDialog does not respond

    Solved
    12
    0 Votes
    12 Posts
    370 Views
    GilboonetG

    @JonB At first I tried to run Wasm using asyncify parameter but it didn't change anything. I suspect that there are others things that are not fitted for Wasm, for example, click on a ToolBar ToolButton that opens a popup menu make Wasm crash, just like right click to open a context menu. I'm still hoping that there's a way to do those things with Wasm as common ways don't work. For the moment I'm simply putting my actions on ToolBars.

  • Wasm apparently doesn't handle keyboard shortcuts

    Solved
    5
    0 Votes
    5 Posts
    319 Views
    GilboonetG

    @RandomGuy For the moment I'm still investigating.

    With Application Windows MenuBar populated, my GraphicsView never receive keyboard shortcuts nor keyboard events event when I click on it to give it the focus. Without MenuBar and with ToolBar as first widget of my GraphicsView's parent layout, it works only if I only use simple ToolButtons, and even then, if I simply hover over one of those ToolButtons and let the tooltip appear, the GraphicsView stop receiving key events. If I try to add a ToolButton with its popupmode set and add a menu to it, WA crashes With a ComboBox instead of the ToolBar, I can have a menu remplacement but my GraphicsView doesn't receive keyboard shortcuts not keyboard events (I redefined a customGraphicsView to handle key events for that).

    I'm open for any solution where a main menu (I have file options , 3d options, and 2d options and need menus, drop down buttons or combo for the user to be able to select them) is usable while the user is able to use the keyboard to move things (on the 3d view but also the 2d), and for the moment I didn't find a way to do so on WA.

  • Just tried building for WS...

    Solved
    8
    1 Votes
    8 Posts
    976 Views
    GilboonetG

    @jsulm My problem was that I had a Qt project from 2 years ago that compiled for WAsm and now has errors (linking errors). It was a QMake project and I converted it to CMake so that now it compiles again. Thank you.

  • QPlainTextEdit font

    Solved
    4
    0 Votes
    4 Posts
    131 Views
    D

    Well, you can't argue with results. Embedding the font as you suggested worked perfectly. Thank you for the suggestion!

  • Web Assembly: QtQuick or QtWidget?

    Unsolved
    3
    0 Votes
    3 Posts
    165 Views
    R

    @JonB Yup that is me. It works just fine. He probably just used .exec() which will cause the application to crash without asyncify. You should use .show() instead.

  • 0 Votes
    5 Posts
    2k Views
    F

    @Pradson "How shall I enable the "Access-Control-Allow-Origin" header at my QHttpSever module?" E.g.:

    QHttpServer httpServer; httpServer.route("/", []() { QHttpServerResponse sr("Hello World!"); QHttpHeaders&& hd = sr.headers(); hd.append(QHttpHeaders::WellKnownHeader::AccessControlAllowOrigin, "http://localhost:30000"); sr.setHeaders(std::move(hd)); return sr; });