Open C ++ Object for Javascript in Qt with QtWebEngine

With QtWebkit, you can expose C ++ objects to Javascript objects via QWebFrame::addToJavaScriptWindowObject , as described in https://stackoverflow.com/a/166269/168/

Is it possible to do the same in Qt 5.4 with QtWebEngine?

+6
source share
1 answer

Exporting C ++ objects to HTML / JS is not directly possible with QWebEngine.

Instead, the new QWebChannel provides a bridge between HTML / JS and C ++. See the documentation , especially for examples. There was also a good opening talk about this year's QWebChannel Qt Developer Days, which may also be of interest to you. Talking videos will be released online in a few weeks.

+8
source

Source: https://habr.com/ru/post/979729/


All Articles