[Interest] reading javascript body from c++

Bo Thorsen bo at fioniasoftware.dk
Mon Dec 10 09:23:05 CET 2012


Den 08-12-2012 11:34, Andy Mayer skrev:
> 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?

I don't think you can do this. It's possible I'm wrong and it is 
possible, I just haven't seen this anywhere. Also, I can't seem to think 
of any valid reason why you want to do this, which is a good indication 
the feature is not going to be there.

Bo Thorsen.

-- 
Fionia Software - Qt experts for hire.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121210/3e21b39f/attachment.html>


More information about the Interest mailing list