Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Showcase
  4. FreeCAD (Qt 6.11 Widgets, JSPI, wasm64) running in the browser
Qt 6.11 is out! See what's new in the release blog

FreeCAD (Qt 6.11 Widgets, JSPI, wasm64) running in the browser

Scheduled Pinned Locked Moved Unsolved Showcase
3 Posts 3 Posters 200 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Virtastic
    wrote last edited by
    #1

    FreeCAD 1.1.3 with its Qt Widgets UI, compiled with Qt 6.11.2 for WebAssembly built from source with -feature-wasm-exceptions -feature-wasm-jspi, threaded, targeting wasm64-emscripten. https://freecad.virtastic.app

    Two Qt-specific things worth knowing if you run a large Widgets app under JSPI:

    1. QtEventListener in qstdweb.cpp is not a promising entry point, so QDialog::exec from a real DOM event throws SuspendError while the same call from a promising export works. We replace the listener with one that dispatches through a promising export.
    2. Qt-wasm only focuses its hidden input element for text widgets, so with anything else focused keydown never reaches Qt. We forward trusted key events to the canvas.

    Both patches, with the measurements that found them: https://virtastic.app/blog/freecad-web-wasm64-runtime/

    Source (LGPL): https://github.com/Virtastic/freecad-web
    Two and a half minutes of it running: https://youtu.be/LJs-75_wSMI

    JKSHJ 1 Reply Last reply
    1
    • V Virtastic

      FreeCAD 1.1.3 with its Qt Widgets UI, compiled with Qt 6.11.2 for WebAssembly built from source with -feature-wasm-exceptions -feature-wasm-jspi, threaded, targeting wasm64-emscripten. https://freecad.virtastic.app

      Two Qt-specific things worth knowing if you run a large Widgets app under JSPI:

      1. QtEventListener in qstdweb.cpp is not a promising entry point, so QDialog::exec from a real DOM event throws SuspendError while the same call from a promising export works. We replace the listener with one that dispatches through a promising export.
      2. Qt-wasm only focuses its hidden input element for text widgets, so with anything else focused keydown never reaches Qt. We forward trusted key events to the canvas.

      Both patches, with the measurements that found them: https://virtastic.app/blog/freecad-web-wasm64-runtime/

      Source (LGPL): https://github.com/Virtastic/freecad-web
      Two and a half minutes of it running: https://youtu.be/LJs-75_wSMI

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote last edited by JKSH
      #2

      @Virtastic Thanks for sharing!

      It seems to run well on Google Chrome, but on Firefox 156.0 I get spammed with never-ending popups that say, "That operation failed and was stopped (can't convert 123456789 to BigInt). Your document is unchanged -- please report this."

      1. QtEventListener in qstdweb.cpp is not a promising entry point, so QDialog::exec from a real DOM event throws SuspendError while the same call from a promising export works.

      Note: nested event loops are known to be problematic so they are discouraged now. https://doc.qt.io/qt-6/qdialog.html#exec says, "Avoid using this function; instead, use open()."

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote last edited by
        #3

        @Virtastic I can confirm the same issue on macOS with Firefox 155.1

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved