Qt 5.13.0: Develop in C++, Run in Browser!

At June. 19th, 2019, Qt 5.13.0 is released. Among the new features there was one thing that caught my eyes....... Qt for WebAssembly. It uses Emscripten to buld a Qt application into WebAssembly. Oh yeah. Now you can run your QML or Qt Widgets applications inside your favorite web browser.

It's surely distinguished from yet another fancy feature, Qt WebGL Streaming Plugin. Under WebGL Streaming Plugin the application runs in the program and web browser merely delivers the GUI interfaces, while Qt for WebAssembly downloads the application to the client and run inside the web browser sandbox environment. Since the program runs in client system, the server load is low, and multiple clients can use the app, whereas in WebGL Streaming Plugin only one client can connect to the server(all other connections are queued until 1st user disconnects).

After encountering the news, well, now I wonder whether they're really humans - oh yeah. They're Trolls(:P) but it was their former glory. Now I'm not sure which alien technology they thieved. Well, anyway.......

Now we can develop under your favorite C++ environment and run in the web browser! To all Qt users and enthusiasts, you don't have to learn Angular or React or Vue.js or whatever to provide a web GUI! The market is moving to the web and now Qt is moved too! Now, DEVELOP WITH Qt AND RUN IN YOUR WEB BROWSER!

......but it didn't take much that my burning heart suddenly got calm. I encountered a few drawbacks.

1. WebGL
Sometimes I have to run web browsers in server environment, but there are a lot of servers(even modern ones) which doesn't support OpenGL 2.0 well. For example, HP DL series server used Matrox graphic chipset until 7th generation at least, which supports only OpenGL 1.2. In that case, you'll encounter an error message from the loader page. :P


2. Broken Hangul (I think that's same for CJK)
I'm not sure whether it's because of WebAssembly sandbox environment itself, Qt for WebAssembly doesn't have privilege to access system fonts. To resolve, you have to "internalize" the font to the application, e.g. putting in qrc file.
Well, I tried, and...... I'm not sure whether this is because of my lack of skills, it doesn't work. Hangul is not shown. And what's more, I can't input Hangul inside the app. The only way to input Hangul is copy and paste - type outside the app, copy it, and paste into the app.Update at Jun.21st. 2019: if I embed a font file into .qrc file, load via QFontDatabase::addApplicationFont(), and set the font as default using QGuiApplication::setFont() at least I can read Hangul, but still I can't input Korean(......).

And there are a handful of small annoyances, e.g. QMAKE_WASM_TOTAL_MEMORY option not working, but considering it's only in the initial release, I think I can overlook those small ones...... :P

Anyway, that's that and there are more limits in the WebAssembly environment. To fully make use of web browser interface, I had better learn Vue.js more, whose structure is said to be similiar to QML.

No comments:

Post a Comment

블로그를 이전합니다

뭐, 이런 작은 변방의 블로그에 관심있으신 분들은 아무도 없으시리라 생각합니다만...... (웃음) 블로그 플랫폼을 블로거에서 dev.to로 옮겼습니다. 새 URL은 아래와 같습니다: https://dev.to/teminian 새로운 거처에서 뵙겠습니...

Popular in Code{nested}