Details

      Description

      QML compiler relies on the runtime infrastructure to evaluate functions (script bindings, JavaScript code, etc.). We should figure a convenient way of interaction between generated code and this runtime. So far, an approach of "engine run this function by index" seems to work fine, but tests are needed. Specifically, test that:

      • basic lazy QML bindings work. E.g.
        width: height + 1 // if height changes, width should change as well
        
      • (C++ generated) signal handlers can pass input/output arguments to the engine and these arguments are usable. at the same time, other variables in scope (e.g. properties of object) are also usable
        signal signal(string x)
        onSignal: function(x) {  // defined in C++, calls the engine
          console.log("received: " + x);
        }
        
      • property change handlers work
        onHeightChanged: {  // defined in C++, calls the engine
          console.log("new height: " + x);
        }
        
      • (C++ generated) bindings can be reset from QML (e.g. as a result of some function invocation)
        width: height + 1  // initial binding, defined in C++ [1]
        onSomeEvent: {
          width = 10  // no binding [2]
          // and:
          width = Qt.binding(height * 2); // new binding [3]
        }
        
        // in C++:
        "getWidth()"
        [1]: returns height + 1 (for some value of height, changing height changes width)
        [2]: returns 10 (and changes to height do not change width)
        [3]: returns height * 2 (for some value of height, changing height changes width)
        
      • QML bindings work on C++ generated properties (related to previous point)
      • runtime code evaluation behaves correctly when JavaScript functions are involved (e.g. property lookup works inside JS
      • property aliases work

      all of the above should also apply to subobjects

      QtObject {  // root object
        QtObject {  // subobject
        }
      }
      

      ... and to property aliases

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            agolubev Andrei Golubev
            Reporter:
            agolubev Andrei Golubev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes