Hi.
This question might be a bit of a long shot, but.. I'm writing some GUI classes in Java that use a similar system to Qt where properties can be scripted. For example, I can set the position of a Widget to be based on the size of itself or a parent Widget, by exposing the Widget object(s) to the scripting language. Here's an example (JSON & JavaScript):
"offset" : {
"x" : "-(me.getSize().getX() / 2)",
"y" : "-(me.getSize().getY() / 2)"
},
"offset" : {
"x" : "-(me.getSize().getX() / 2)",
"y" : "-(me.getSize().getY() / 2)"
},
To copy to clipboard, switch view to plain text mode
I noticed that calling the script every frame is really slow - the FPS goes from ~3000 to ~150. I have thought about various ways to cache the values of the properties that are scripted, but the solution always involves having some kind of listeners that observe the values held by the objects that the scripts rely on, which I think will end up really messy.
So, I'm wondering if Qt does anything in terms of caching the result of scripted QML properties? I know C++ is different to Java in terms of performance, but I thought I'd ask anyway.
Cheers.
Bookmarks