Hey guys,

I'm trying to add a _function_ to the window Javascript object exposed
by QtWebkit in all its pages.

I know how to add an _object_ to this window object, proceeding like
this in my QWebView:

> QWebFrame *frame = page()->mainFrame();
> MyObject *object = new MyObject();
> frame.addToJavascriptWindowObject( "myObject", object );

And then, thanks to the magics of Qt (here:
http://doc.qt.nokia.com/latest/qwebframe.html#addToJavaScriptWindowObject
), any slot on my object will be callable from the Javascript like
this:

> window.myObject.mySlot( argument );


Now, what I want to do is to have this in Javascript:

> window.myFunction( argument );


How can I add the "myFunction" _function_ to the window object?
I suppose that the addToJavascriptWindowObject() won't do, since an
object is not "executable" in Javascript.
I looked into the QWebFrame object to see what this function does, but
it seems that the window object is not easily reachable from the Qt
code.

Any idea?

Thanks,
Guillaume
_______________________________________________
webkit-qt mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt

Reply via email to