QtWebChannel - Bridging the Gap between HTML and Qt

milian's picture

Milian Wolff
KDAB
Europe Date: 
Wednesday, October 8, 2014 -
11:30am to 12:30pm
Europe Room: 
C1
Europe Track: 

Presenter Bio: 

Milian Wolff works at KDAB as a Software Engineer and contributes to Qt and KDE for quite some years now. Tooling in general is of huge interest to him: For KDAB he contributed to PhantomJS, a headless WebKit based on Qt, which is an incredibly useful tool for any web developer. Furthermore he worked on GammaRay, which is invaluable to any Qt developer. Within the KDE community, he is one of the most active contributors to KDevelop and Kate. He wrote the Massif-Visualizer, played around with a GDB based profiler and also looked into tooling around Linux malloc to investigate memory consumption, performance and fragmentation issues. Before he became a C++ developer, Milian worked as a web developer and thus knows the other side of the fence as well.

Abstract: 

The new QtWebChannel module is a ready-to-use solution to make any QObject accessible to arbitrary JavaScript clients. KDAB already uses it in production for a client project on embedded devices, where it proofed to be an essential part for the HTML app framework embedded in a QML chrome.

Thanks to QObject introspection, any object can be mocked on the fly for the JavaScript side. Thus any properties, signals and public slots are seamlessly accessible. An asynchronous message passing interface based on either WebSockets or the internal QtWebKit or QtWebEngine IPC mechanism allows to connect the C++/QML server side with the JavaScript/HTML client side. With WebSockets, one can even cross the machine boundary and publish QObjects to remote JavaScript clients. Furthermore, it also allows you to access these objects from node.js applications or from within a non-Qt browser, such as Firefox, Chrome or Internet Explorer.

This presentation will show you how simple it is to setup the QtWebChannel. We will share some tips and tricks learned from using it in production. At the end some more creative use-cases will be shown, such as accessing C++ QObjects from within node.js.