Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Porting desktop app to WebAssembly: Good pattern to replace QDialog::exec() calls?
Forum Updated to NodeBB v4.3 + New Features

Porting desktop app to WebAssembly: Good pattern to replace QDialog::exec() calls?

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
3 Posts 3 Posters 819 Views 1 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.
  • K Offline
    K Offline
    Kinhcam
    wrote on 11 Oct 2020, 21:08 last edited by Kinhcam 10 Nov 2020, 21:19
    #1

    In simple cases it's easy to replace QDialog::exec() with the asynchronous QDialog::open() and moving all the code to run after the dialog is closed to a lambda/function executed when that dialog emits QDialog::finished with the return code QDialog::Accepted.

    When porting a larger application with more complex logic, I cannot find a good, "works-in-all-cases" replacement for QDialog::exec(). Sometimes a dialog has to return a value BEFORE the function creating it returns, and there is no way to stop that function until it does... Simply put, I need a modal, synchronous QDialog::open(). If necessary, the background can remain frozen, until the dialog is closed.

    I have to port many calls like this:

    while (someQDialog.exec());
    

    which repeatedly opens a dialog where a new item can be defined, until the user cancels it. How could I make this work with WebAssembly?

    I have compiled Qt for WebAssembly with multithreading support.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lorn.potter
      wrote on 12 Oct 2020, 09:39 last edited by
      #2

      exec() on wasm does not work like any other system, it will never return, because nested event loops are not supported in Emscripten/webassembly.

      You would need to use signals and slots and show() to get any return values from any dialog.

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      J 1 Reply Last reply 12 Oct 2020, 11:05
      1
      • L lorn.potter
        12 Oct 2020, 09:39

        exec() on wasm does not work like any other system, it will never return, because nested event loops are not supported in Emscripten/webassembly.

        You would need to use signals and slots and show() to get any return values from any dialog.

        J Online
        J Online
        JonB
        wrote on 12 Oct 2020, 11:05 last edited by JonB 10 Dec 2020, 11:06
        #3

        @lorn-potter
        Hi there. I know Qt WebAssembly is a work-in-progress. Is there a current (preferably "definitive") list anywhere of what does not work from Qt which we can read/refer other questioners to? Otherwise we seem to wait for you to pop in here! :)

        1 Reply Last reply
        0

        1/3

        11 Oct 2020, 21:08

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved