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.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to