[Interest] Qml bindings with javascript library functions in them

Josh Faust jfaust at suitabletech.com
Thu Jun 13 20:29:53 CEST 2013

Hey all,

I have a javascript library, with functions that are used in a lot of
bindings. I'm trying to get those bindings to reevaluate when some
variables used inside the functions change. A simple example:

// JS.js
.pragma library
var _Value = 0;
function getValue()
  return _Value;

function setValue(val)
  _Value = val;


// in use
Column {
  Text {
    text: JS.getValue()

  Button {
    onClicked: JS.setValue(JS.getValue() + 1)

When _Value changes, I'd like the QML binding to reevaluate. At the moment
it doesn't look like it will -- and even using JS._Value directly, and
modifying it directly, none of the bindings reevaluate. Is this expected?
Is there any way for me to force reevaluation of these bindings (I'd even
be happy forcing a re-evaluation of all bindings from C++ -- this is for a
development-time feature, so performance is not a concern).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130613/4ca314e1/attachment.html>

More information about the Interest mailing list