Hi Jan, > From: j...@flaska.net > To: interest@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
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest