6

I am a C++ programmer, but for some reason, I have to develop a website by myself (my own commercial project). I don't want to take a lot of time to study JavaScript and something else.

Is it possible to just use Qt and WebAssembly instead of HTML, CSS, and JavaScript to develop a frontend web application?

1
  • See also Emscripten. Commented Jul 21, 2024 at 13:33

2 Answers 2

5

Yes, it's absolutely possible and I'm currently doing it for a project but you should do it carefully based on the project requirements, running environment and your own backgrounds. Here are some problems you may encounter:

  1. The output .wasm file may get too large. Generally, it won't be suitable for public domain applications.
  2. In low-end devices, maybe you find it laggy if you don't do enough code level optimizations.
  3. Threads are not officially supported yet (as of Dec. 2019) by major browsers but tech-preview is available. This is not a real big problem as it would be a standard feature soon.
  4. Native virtual keyboard won't work on mobile devices but the work is in progress.

These were my own major problems with Qt for WebAssembly. Despite this, I find it much more flexible than HTML+CSS. QML is really a nice language for UI development. Creating animated UIs is quite easy and straight-forward. You can also use many JavaScript libraries in your QML code like Lodash and Moment or any other js library that does not refer or manipulate window DOM.

Sign up to request clarification or add additional context in comments.

2 Comments

Webdev here. HTML+CSS is actually more flexible. QML is on the higher level up to UI componets, where HTML+CSS is lower level to graphical primitives. It is possible to go up the level using declarative framework like React and any component library like MUI.
@IgorSukharev HTML+CSS is for sure way higher level than QML. What you are referring to, is probably Qt Quick Controls which is a set of UI components/controls written in C++ and QML.
2

Yes, it is possible. But you should do not do it if your only reason is rejecting learning new technologies.

For now (using Qt 5.14), Qt for WebAssembly is deployed as an official platform.

Unfortunately, it is young platform support with a lot of problems and possible future changes.

You should know Qt for WebAssembly does support all Qt modules. See Supported Qt Modules.

Qt for WebAssembly was created for the purpose of port one code base in other platform (it is generally Qt develop way, please see Qt for MCU). With other technologies in this stack, like QRemoteObject, are very interesting technologies. It was not created for websites in a normal network.

The main Qt for WebAssembly target are internal network systems and remote control of devices. Pay attention to this.

Unfortunately, not all browsers will support WebAssembly. See Qt for WebAssembly support notes.

Additionally, in Qt, you can't find a built-in rest-API handle or other standard web technologies to integrate with your existing backed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.