jviotti
jviotti

Reputation: 18909

Run a c++ method from JavaScript (QTWebkit)

I can inject JavaScript to qtwebkit like this:

view->page()->mainFrame()->evaluateJavaScript();

But is it a way to do the inverted process? Runnin a C++ Method from JavaScript?

I thought about parsing the *js files with C++ and include some prefixed calls in the javascript to detect calls.

Is there a way to accomplish this?

Upvotes: 0

Views: 183

Answers (1)

Alexander Stepaniuk
Alexander Stepaniuk

Reputation: 6408

There is great built-in ability in Qt to integrate C++ and Javascript code. It is easily possible to make QObject available in script engine.

Just take a look at Making Application Scriptable.

Upvotes: 2

Related Questions