Monday, November 19, 2012

Quickie - QtCore.js Progress Update

A quick follow-up to my previous blog here. In a nutshell - I'm experimenting with using Emscripten to try and compile Qt+C++ apps to Javascript and HTML5, so that they can be run in a browser (with some limitations).

Well, looks like I got lazy again ;) But having just restarted working on this, I now have QFile support working, and more importantly, a limited "event loop" which now means I can use QTimer, queued connections, posting events etc. This represents a big chunk of QtCore, and although I wasn't in any doubt that they would work, it's nice to see that all the moc+signal+slot stuff works seamlessly :)

I'll now start working on the GUI part. Qt's QWS, at a cursory glance, seems like it does a *huge* amount of stuff for you, mainly leaving the tasks of flushing pixels to screen (using Canvas's "putImageData" method, in this case) and providing it with mouse and key events. I'm sure that there's a whole host of little devils lurking in the details, though :)

Konqueror and Rekonq now work (I suppose they don't support the typed arrays which are Emscripten's default); the current test example can be found here: it is 2.3MB, but if your browser (and my webserver) support gzip, then it should be about a 280k download. Gobbles quite a bit of RAM, though :/

Source code for the example:



Anonymous said...

Pretty awesome work! Looks promising, can you make an example for memory consumption?

SSJ said...

Thanks! Here are some completely unscientific memory readings, taken from the "Memory" column of KSysguard, and using the earlier example:

Firefox, just started up, blank ~63MB

Loading & executing the example, peak ~164MB

Later settles down to ~110MB

akreuzkamp said...

Hi, I'm currently heavily investing in qmlweb, a project to bring qml to the webbrowser ( How much do these projects overlap? Might there be the possibility to collaborate?

SSJ said...


Just had a quick look - are you using the browser's native Javascript engine to implement QML? If so, then our project's don't overlap at all - which means they are perfectly complementary :)

I've been concentrating on C++ and ignoring the Javascript part, and you've been concentrating on the Javascript part and ignoring the C++ :) When I have things a bit more settled and organized, I'll host everything I have publically and we'll see if there's any way of putting our two pieces of the puzzle together :)

3DH said...


a really awesome project! I'm curious to see more :-)