Qt 5: QtWebkit 3/WebKit2: Bridging C++ objects to Javascript and vice versa

  • Hello,

    I would like to expose C++ QObjects to Javascript code. With Qt 4.8 it was pretty straightforward. With Qt 5 also but by using/binding to the "old" WebKit1 (QtWebKit 2.0).

    Does this QObject exposition/bridging mechanism still exists with WebKit2 (QtWebKit 3.0)?

    That would be great in order to benefit of the latest WebKit developments and of the V8 engine. If I'm correct, these are shipped in Qt 5.

    Looking at Qt 5 documentation, the old bridging mechanism is detailed. I guess it should marked as deprecated or "going to be deprecated" since this mechanism uses the old WebKit (http://qt-project.org/doc/qt-5.0/qtwebkit/qtwebkit-bridge.html).

    In the case the exposition is not available anymore, is there a way to make communicate Javascript and C++ directly?

    My idea is to use the WebKit engine as the GUI and part of the business logic of my application (using all those nice .js dev framework and graphical libraries) then C++ is used for running webkit, interacting with files or hardware, doing intensive calculation (V8 could also do the job ;) ). I don't want to use extensively QML/QtQuick (that is, up to my limited knowledge, redundant to HTML5+Js).


Log in to reply