O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data transport between app and browser with WebChannel

One piece of the puzzle is still missing, that is, how do we interact, within a standard web page, with objects that might have been created on the C++ or QML side?

A dedicated Qt module — QtWebChannel — comes to the rescue (http://doc.qt.io/qt-5.9/qtwebchannel-index.html). The concept is simple; you register with the WebChannel any objects that you want to have available in your client JavaScript environment. Once this is done, these objects will be accessible from the JavaScript code, including their signals, properties, and so on. In our case, we want the HTTP receiverChannel instance implemented in the previous sections to be available in the HTML page.

QtWebChannel provides communication ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required