[Qt-interest] Help! calling a JavaScript function from a Qt object

Howard hpage66 at gmail.com
Mon Jun 21 20:16:56 CEST 2010


Folks, any assistance with this issue would be appreciated...

I added an object to the JavaScript context with
addToJavaScriptWindowObject(). Works great. Now I wish to specify a
JavaScript callback function to be called from Qt:

function cb()
{

    foo = bar;

}

MyObject.cbfun = cb;

In my Qt object (MyObject) I see the QVariant Q_PROPERTY cbfun is
actually a QVariantMap of length zero! I need the name or some other
type of handle to be able to call JavaScript function reverenced by
cbfun from my Qt object.

Note that one can easily call the JavaScript function "cb" with
evaluateJavaScript(), but that requires a priori knowledge of the
callback function name -- this is not what I need..

Any ideas how I can get the name of my callback function or any other
type of handle that would allow me to call it from my Qt object?
Thanks!

Howard



More information about the Qt-interest-old mailing list