[Interest] Accessing the raw value of QQmlScriptString (QDeclarativeScriptString::script)
Michael Brasser
michael.brasser at live.com
Wed Sep 4 23:18:21 CEST 2013
Hi Jan,
> From: jkt at flaska.net
> To: interest at qt-project.org
> Date: Wed, 4 Sep 2013 16:06:26 +0200
> Subject: [Interest] Accessing the raw value of QQmlScriptString (QDeclarativeScriptString::script)
> > ...
>
> As it is right now, the application is using QtDeclarative for parsing the
> definitions of the allowed data types. An internal data structure is
> created and the actual string "price < 666 && procured >= 2012" is stored
> for later use. The GUI of this application is based on QGraphicsScene, and
> when it is time to validate the object properties, a throwaway
> QDeclarativeExpression is created, we feed its context object actual data
> via setContextProperty() calls, and in the end evaluate the expression.
> Now, this specific case describes a pretty trivial concept which is
> expressible by simple boundary checking, but we want to support more
> complicated expressions including function calls to some utility JS
> library.
The QQmlExpression constructor that takes a QQmlScriptString allows setting a custom context and scope object to replace the default one provided by the QQmlScriptString. Is this enough to accomplish what you need?
> Can I somehow access (and reuse in an QQmlExpression later) the raw,
> unprocessed script value in Qt5's QtQML? Why was the script() method
> removed in Qt5, and would you object to a patch adding it back? Is that
> feasible, technically?
This was removed in commit aa25ad8d5f476d6db59012a122833ebe677eaf69 ("Allow for future optimization by encapsulating the raw script data."). Unfortunately I do not remember the details of the optimizations being discussed at the time (it may have been related to memory consumption, or to pre-compiling QML, or to early prototypes of v4).
Regards,Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130904/9f341831/attachment.html>
More information about the Interest
mailing list