[Interest] reading javascript body from c++

Thomas McGuire thomas.mcguire at kdab.com
Sat Dec 8 19:25:46 CET 2012


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
-- 
Thomas McGuire | thomas.mcguire at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3637 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121208/ed2a2933/attachment.bin>


More information about the Interest mailing list