Am 08.12.2012 19:25, schrieb Thomas McGuire:
Hi,
On Saturday 08 December 2012 11:34:17 Andy Mayer wrote:
I have a question regarding the possibilty of reading the body of a
javascript function from c++. I want to create a DSL based on QML and I
have to read the body of a javascript function.
e.g.
QML:
Item {
function action() {
console.log("Got message:", msg)
return "some return value"
}
}
C++:
QDeclarativeEngine engine;
QDeclarativeContext context(&engine);
QDeclarativeComponent component(&engine,
QUrl::fromLocalFile("MyItem.qml")); QObject* qmlSpenat =
component.beginCreate(&context);
QString actionString=qmlSpenat->property("action");//??? it doesn't
work, anything else?
Should work with QMetaObject::invokeMethod().
Regards,
Thomas
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
Thanks for the answer, but I don't want to invoke the javascript method.
I want to read out the body of the javascript method from C++.
e.g.: If I have a Javascript method within a qml-file
function action() { var x=0; return x+2;}
the question is: Is it possible to get the body "var x=0; return x+2;"
as QString (or something else?) from C++ side?
Regards
Andy
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest