[Interest] reading javascript body from c++

Andy Mayer amayer19 at gmx.net
Sat Dec 8 11:34:17 CET 2012


Dear all,

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?

Regards
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121208/68016205/attachment.html>


More information about the Interest mailing list