title: Qt Script function wrapping
body: <p>I am going through the documentation of Qt Scripting and came up to it is totally confusing and full if mis guiding text. Could some please explain in simple English how to wrap a function and access it in script code after wrapping. I have included my example below.
  Wrapper function. This is a simple wrapper which I need to return the string that is passed as the parameter. following is the code.</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QtScript/QScriptEngine&gt;
  #include &lt;QtScript/QScriptContext&gt;
  #include &lt;QDebug&gt;
  
  QScriptValue returnProperty(QScriptContext *context , QScriptEngine *engine)
  {
      qDebug() &lt;&lt; "running returnValues Function "&lt;&lt; context-&gt;argument(0).toString();
      return context-&gt;thisObject().property("returnValue");
  } 
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc,argv);
      QScriptEngine engine;
      //Evaluating a simple expression
      qDebug() &lt;&lt; engine.evaluate("1+2").toNumber();
  
      QScriptValue func = engine.globalObject();
      func.setProperty("foo",engine.newFunction(returnProperty),QScriptValue::PropertyGetter);
      engine.evaluate("var v= foo('name') ; print( 'This prints values from addValues function :',v) ;");
  }
  </code></pre>
  
  <p>And the output is as follows</p>
  
  <pre><code>3
  Running returnValues Function  "undefined" 
  </code></pre>
  
  <p>If I am understanding this correctly this is what I should do and if I call engine.newObject() as it is mentioned in the doc function does not even get called.</p>
  
  <p>what I do not get here is that in what is the property I am assigning in func.setproperty line and what can I do with the property foo once I set it. How can I set a value in the function.</p>
  
  <p>I appreciate if someone explain what I am doing wrong here. </p>