[webkit-qt] JSFunction as parameter in slot?

sunny shah sunny.cpp at gmail.com
Mon Dec 27 01:23:19 PST 2010


Hi ,

 Somebody replied over here
http://stackoverflow.com/questions/4532924/jsfunction-as-parameter-in-qt-slotlike
this.

"Unfortunately, it's impossible to do this in a cleaner way in QtWebKit, at
this point. There's been some effort to add full JavaScript <-> C++ bindings
to QtWebKit, on top of QtScript, but I'm not sure what the progress on that
is."

do you think that It is true?

Thanks,
 Sunny.

On Sun, Dec 26, 2010 at 11:26 AM, sunny shah <sunny.cpp at gmail.com> wrote:

> 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/20101227/777339c2/attachment.html>


More information about the webkit-qt mailing list