[Qt-interest] Invoke function in JavaScript
Gopalakrishna Bhat
gopalakbhat at gmail.com
Wed Dec 15 08:01:37 CET 2010
Hi,
What do you mean by putting new_data into the function? If I
understand it right, you can pass new_data as a parameter to apply.
With regards,
Gopalakrishna Bhat
On Wed, Dec 15, 2010 at 11:43 AM, Joshua Lee <muzili at gmail.com> wrote:
> Hi No'am,
> Here's an example,
>
> QVariant TestApi::jsCall(const QString &function, const QVariant
> user_data, const QVariant& new_data)
> {
> QString script = QString( "%1.apply(this, %2)").arg(function).arg(user_data);
> return webframe->evaluateJavaScript(script);
> }
>
> How can i put the new_data into the function?
>
> Thanks.
>
>
> Best regards,
> Joshua
>
> On Wed, 15 Dec 2010, noam.rosenthal at nokia.com wrote:
>
>> >-----Original Message-----
>> >From: ext Joshua Lee [mailto:muzili at gmail.com]
>> >Sent: Tuesday, December 14, 2010 7:56 PM
>> >To: Rosenthal Noam (Nokia-MS-Qt/RedwoodCity)
>> >Cc: mars.leezm at gmail.com; qt-interest at trolltech.com
>> >Subject: Re: [Qt-interest] Invoke function in JavaScript
>> >
>> >Hi No'am,
>> >I want pass C++ value to javascript function 'foobar',
>> >how to get it?
>> >
>> You convert it into a QScriptValue, e.g. by wrapping it in a QVariant (http://doc.trolltech.com/4.7/qscriptengine.html#newVariant)
>>
>> I suggest some light reading: http://doc.trolltech.com/4.7/scripting.html
>> It's all there :)
>>
>> No'am
>
> --
> Joshua Lee
> Alpha Networks(Chengdu) Co., LTD
> Shanghai Branch
>
> TEL: (86-21)61609650 EXT: 8020
> FAX: (86-21)61609650 EXT: 8041
> ADD: Suite 301, No.10, 198 Lane, Zhangheng Road,
> ZJ Hi-Tech Park, Shanghai, China 201204
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
My blog http://gkbhat.blogspot.com
More information about the Qt-interest-old
mailing list