Reputation: 66995
What I need is simple: we have a console app project. We want to have such a function that would open a simple window with nothing but html QtWebKit html+js rendering window that would read some default html+js string (form string or const char*). we want to have our own api joined with default js api so that when JS calls some our.function(argument);
we would have our C++ application performe some function and for example cout argument. How to create such thing using Qt?
PS: this question is related to my previous one , I just suddenly got Idea that doing it once for all platforms would be much better.
Upvotes: 2
Views: 969
Reputation: 4954
Have a look at QWebFrame::addToJavaScriptWindowObject(). It lets you expose a C++ QObject to the javascript in your page. Your html+js can then call C++ methods on that object from the web page.
Upvotes: 1