QtScript handling callback functions with QScriptValue

Nikhil Marathe nsm.nikhil at gmail.com
Thu May 20 11:21:39 CEST 2010


Hi,

I am experimenting with QtScript and was looking at the Plasma
JavaScript API for various examples. One particular is the
addEventListener(name, func) on the global plasmoid object. The C++
implementation of addEventListener has a prototype

    void addEventListener(const QString &name, const QScriptValue &function);

implying that QScriptValue is used to 'collect' a function definition
(a callback) in the C++<->QtScript bridge. But when I am trying my own
code with something similar, my function is not called.

The script engine throws an exception that "unknown type `QScriptValue'"

So my question is, is there something special that has to be done to
allow QScriptValue to get functions.

Thanks and regards,
Nikhil


More information about the Plasma-devel mailing list