Converting an Existing Project to a Web Application
-
wrote on 25 Aug 2023, 04:28 last edited by
Hi All,
I have an existing desktop QT Widget application created using QT creator. Is it possible to convert ant such application to a Web Application using Web Assembly.
Thanks!
-
Hi All,
I have an existing desktop QT Widget application created using QT creator. Is it possible to convert ant such application to a Web Application using Web Assembly.
Thanks!
Yes, sure. Widgets work in WASM out of the box.
-
@sierdzio
Thanks! Is there any resources I can read on to convert an existing Widget application to a Web Application?This is a good place to start: https://doc.qt.io/qt-6/wasm.html
But in general, just get Qt for WebAssembly, compile your app with it and that's it. If you're not using any unsupported modules it will just work, without needing any adjustments in code.
-
This is a good place to start: https://doc.qt.io/qt-6/wasm.html
But in general, just get Qt for WebAssembly, compile your app with it and that's it. If you're not using any unsupported modules it will just work, without needing any adjustments in code.
wrote on 25 Aug 2023, 07:41 last edited by Radio1985@sierdzio
When I create a new project from QT Creator, I get the options of selecting WebAssmebly kits as shown below.
Can we use this Webassembly kit to convert my application to a web application? If so how can I do it?
If not what is the purpose of having including this kit into a project? -
@sierdzio
When I create a new project from QT Creator, I get the options of selecting WebAssmebly kits as shown below.
Can we use this Webassembly kit to convert my application to a web application? If so how can I do it?
If not what is the purpose of having including this kit into a project?There is nothing to convert, really. WASM is treated by Qt as a different platform, so it's the same as if you were compiling the project for Android, or Linux, or macOS. It's always the same source code, just compiled and packaged by different tools.
You need to select a proper Kit for compilation. This tells Qt Creator which compiler to use, which Qt version to link to, and how to deploy the project.
-
There is nothing to convert, really. WASM is treated by Qt as a different platform, so it's the same as if you were compiling the project for Android, or Linux, or macOS. It's always the same source code, just compiled and packaged by different tools.
You need to select a proper Kit for compilation. This tells Qt Creator which compiler to use, which Qt version to link to, and how to deploy the project.
-
wrote on 29 Aug 2023, 08:01 last edited by
I haven't used WebAssembly so far. But the screenshot made me curious: Are there any pointers for using multi-threaded vs. single-thread? Should one prefer one of the other always? Or what would be the selection criteria?
-
I haven't used WebAssembly so far. But the screenshot made me curious: Are there any pointers for using multi-threaded vs. single-thread? Should one prefer one of the other always? Or what would be the selection criteria?
wrote on 29 Aug 2023, 08:11 last edited by RandomGuy@SimonSchroeder I have been using it internally and it works really well. I went with the single thread approach (without async) as that seems to be the most supported version and for an application that behaves like a website I don't really need threads anyway.
There are some things that we need to be careful like not calling code that breaks the Qt event loop like qdialog.exec(). There are also some things that don't work as expected but that I found workarounds for and bug reports have been opened, so they will be fixed in the next versions.
https://doc.qt.io/qt-6/wasm.html
Is a good place to start reading.Version 6.5.2 seems to work decently well and it will be good to start. You can also check the betas to see how bugs are getting fixed (in case you run into some issue with 6.5.2).
1/9