[Interest] QML binding on JS function involving JS object modifications

Christopher Courtois courtois.christopher at gmail.com
Tue Jun 10 19:41:04 CEST 2014


Hi,

I would like to bind from QML to a JS function that tells me if a JS object
has a specific property.

Example:

property bool myAttributeExists : JS.contains("myAttribute")


Since JS objects doesn't trigger binding reevaluation I had to introduce a
dummy qml property dependency in my contains function and update its value
whenever I push/remove a property from my object.
Then every time this property gets changed (boolean toggling) every qml
expression calling this function gets reevaluated.

This solution work but it is very hacky actually and involve qml
boilerplate (dummy properties).

So I'm wondering if there is a better way to do it ?

Thanks,

Christopher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140610/528922b5/attachment.html>


More information about the Interest mailing list