[webkit-qt] JSFunction as parameter in slot?

sunny shah sunny.cpp at gmail.com
Sat Dec 25 21:56:41 PST 2010


Hi,

I want to write a Qt slot similar to following javascript,

    function testFunc( func1,func2,cond )
    {
       if ( cond == 1)
       {
                func1();
       }
      else
      {
               func2();
      }
    }

Question for me is
1). how to receive Javascript function as an arguement?
2). how to call same JS function from C++ again.

Here are my non-efficient solutions,

For Q.1-> taking JSFunction arguement as a QString gives me full function
code, So in this case I need to write code to extract just function name
from there.

For Q.2-> I can call JS function by  QWebFrame::evaluateJavaScript, but for
this I need to construct a string of function name  + all the function
arguements.

So is there any better solutions available for this problem?


Many Thanks,
 Sunny.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20101226/38f93f95/attachment.html>


More information about the webkit-qt mailing list