Qt Desktop app to browser app
-
Hi, I have a heavy OpenGL Qt desktop app and I would love to make it run in the browser. It relies on some 3rd-party packages, e.g. QWT, boost, libssh2, etc. Is there an easy way to do this? Maybe using WebAssembly or some other approach? Or do I need to rewrite the whole app?
Stack: Qt 6.10.2, Windows and Linux builds
-
Hi and welcome to devnet,
Qt has webassembly support however I don't know for your other dependencies. You need to check that.
You should also verify which modules you are using as they might not be supported yet. -
Hi, I have a heavy OpenGL Qt desktop app and I would love to make it run in the browser. It relies on some 3rd-party packages, e.g. QWT, boost, libssh2, etc. Is there an easy way to do this? Maybe using WebAssembly or some other approach? Or do I need to rewrite the whole app?
Stack: Qt 6.10.2, Windows and Linux builds
@Trdhjh said in Qt Desktop app to browser app:
heavy OpenGL
Be aware that browsers currently support OpenGL ES 2.0 at most (see https://stackoverflow.com/questions/36053620/which-version-of-opengl-is-supported-by-webgl )
libssh2
I haven't tested, but I have a feeling that you can't open a raw SSH connection from a browser app.
-
Looks like there is something in the work.
-
Of course you have to rewrite the application. A desktop application (unless you have something stupidly trivial) won't ever work as-is on the web.
The web is an insecure environment and therefore the web APIs have very much different semantics and UX compared to what you have no the desktop. For example file access.
There are several low level differences in the APIs and their semantics. For example threading since you mention OpenGL, on the web only the JS main thread can make draw calls or use web audio.
Bottom line is, even if your C++ code compiles with Emscripten, the semantics of pretty much every and each API is different, the UX how users expect things to work is totally different and unless you designed your application for this from the start it's not going to work.
-
I wouldn't assume a rewrite yet. If most of the app is already Qt-based, WebAssembly is probably the first thing I'd evaluate. The biggest challenge is usually not Qt itself but the OpenGL requirements and whether all the third-party libraries can be built and run in the browser environment.
A small proof-of-concept build is likely the fastest way to see how much work you're actually facing.