title: Javascript function as QML property defined from c++
body: <p>I have the following QML object defined in c++:</p>
  
  <pre><code>class MyObj : public QQuickItem {
      Q_OBJECT
      Q_PROPERTY(QVariant func MEMBER func)
  
  public slots:
      void callFunc(){
          //Call function pointed by "func" somehow
      }
  
  private:
      QVariant func;
  };
  </code></pre>
  
  <p>In QML I use <code>MyObj</code> as follows:</p>
  
  <pre><code>MyObj{
      func: function test(){ console.log("Hi!"); }
  
      Button{
          text: "Call func"
          onClicked: parent.callFunc()
      }
  }
  </code></pre>
  
  <p>I'm getting the following error:</p>
  
  <pre><code>Unable to assign a function to a property of any type other than var.
  </code></pre>
  
  <p>I don't understand, isn't a <code>QVariant</code> property supposed to be identical as a <code>property var</code>? What is the correct way of doing this?</p>