[Interest] reading javascript body from c++

Koehne Kai Kai.Koehne at digia.com
Tue Dec 11 10:21:20 CET 2012


> -----Original Message-----
> From: interest-bounces+kai.koehne=digia.com at qt-project.org
> [mailto:interest-bounces+kai.koehne=digia.com at qt-project.org] On Behalf
> Of Lincoln Ramsay
> Sent: Tuesday, December 11, 2012 12:03 AM
> To: interest at qt-project.org
> Subject: Re: [Interest] reading javascript body from c++
> 
> Since QML has a JavaScript engine underneath it, have you tried using
> JavaScript to get the text of the function and store it in a string variable for
> C++ to grab?
> 
> ie.
> http://stackoverflow.com/questions/3379875/can-javascript-get-a-function-
> as-text
> 
> I don't know if this actually works or not but I didn't see it suggested...

Other ideas:

Use v8 debugging API to get the text, e.g. by setting breakpoints and do a "Request: source" [1].
Parse .qml files on your own (there's a QML parser both in qtdeclarative and Qt Creator which you can copy).

[1]: http://code.google.com/p/v8/wiki/DebuggerProtocol

> 
> 
> There is a way to get the text of an item (if that item is your own type).
> Might work for you but it's private API. QQmlCustomParser. It's how
> PropertyChanges can take the names of items and properties and then
> actually do useful things with them.
> 
> 
> --
> Link



More information about the Interest mailing list