[Qt-interest] Invoke function in JavaScript
Zhongmiao Li
mars.leezm at gmail.com
Wed Dec 15 01:59:27 CET 2010
Thanks! It almost works, but the last problem comes out from the
following line:
QScriptValue result= mouseReleaseFunction.call(new QScriptValue(), null));
result is TypeError: Arguments must be an array
But in QtJambi, only call(QScriptValue arg0, QScriptValue arg1) is defined!
So is there some constructor of QScriptValue that can make
QScriptValue contains an array?
Thanks!
On 12/14/10, noam.rosenthal at nokia.com <noam.rosenthal at nokia.com> wrote:
> Do you mean invoke javascript-defined function from C++?
> Yes.
>
> script:
>
> function foobar() {
> ... do something ...
> }
>
> c++
>
> QScriptValue foobarFunction = scriptEngine->evaluate("foobar");
> QScriptValue returnValue = foobarFunction.call();
>
> See http://doc.qt.nokia.com/4.7/qscriptengine.html#evaluating-scripts
>
> No'am
> ________________________________________
> From: qt-interest-bounces at trolltech.com [qt-interest-bounces at trolltech.com]
> On Behalf Of ext Zhongmiao Li [mars.leezm at gmail.com]
> Sent: Tuesday, December 14, 2010 5:07 AM
> To: Qt-interest
> Subject: [Qt-interest] Invoke function in JavaScript
>
> Hi everyone,
>
> when using QScript, is it possible to invoke a function defined in
> JavaScript? Thank you!
>
> --
> Best regards
> Li Zhongmiao
> Digital Media, College of Computer Science, Zhejiang University
>
>
--
Best regards
Li Zhongmiao
Digital Media, College of Computer Science, Zhejiang University
More information about the Qt-interest-old
mailing list