On Thu, Jun 13, 2013 at 11:41 AM, Alan Alpert <4163654...@gmail.com> wrote:
> Bindings do not update when a purely JS variable changes, it can only > respond to changes in QML properties. You could bind to something like > stateObject.value, and still be able to use > JS.setValue(stateObject.value + 1) if you wanted. But without going > through C++ though you couldn't make stateObject.value read-only to > everything but the setValue function. > Ah, I had forgotten about the distinction between properties and JS variables. That gave me an idea though, and it looks like it works. I can pass a QML object into the javascript, and use a property from it: var _GenerationObject; var _LastGeneration; var _Value; function setGenerationObject(obj) { _generationObject = obj; } function getValue() { // Force re-evaluation if _GenerationObject.generation changes if (_GenerationObject.generation != _LastGeneration) { _LastGeneration = _GenerationObject.generation; } return _Value; } function setValue(val) { _Value = val; ++ _GenerationObject.generation; } Now the only trick is getting that value set before anything else constructs, but that should be solveable. Thanks! Josh
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest