title: Declaring a signal in Qt script prototype
body: <p>I tried declaring a signal in a prototype and then connecting it is script funcition for some reason it does not work as I hoped. My code is as follows. Could some one help me in this.</p>
  
  <p>What I expected was, once I called <code>p.setText('New String')</code> in the script code, since setText emits the textChanged signal it should invoke the slot which is <code>catchSignal(text)</code> already connected in the script code.</p>
  
  <p>Prototype header</p>
  
  <pre><code>#ifndef SCRIPTACTION_H
  #define SCRIPTACTION_H
  
  #include &lt;QObject&gt;
  #include &lt;QtScript&gt;
  
  class ScriptAction : public QObject , public QScriptable
  {
      Q_OBJECT
  
   public:
      ScriptAction(QObject *parent = 0);
  
   signals:
      void textChanged(const QString changedString);
  
  };
  
  #endif // SCRIPTACTION_H
  </code></pre>
  
  <p>Class</p>
  
  <pre><code>#include "scriptaction.h"
  #include &lt;QAction&gt;
  
  Q_DECLARE_METATYPE(QAction*)
  
  
  ScriptAction::ScriptAction(QObject *parent) : QObject(parent)
  {
  }
  </code></pre>
  
  <p>Main Class</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QDebug&gt;
  #include &lt;QAction&gt;
  #include "scriptaction.h"
  #include &lt;QPushButton&gt;
  
  Q_DECLARE_METATYPE(QAction*)
  
  QScriptValue qAction_Constructor(QScriptContext *ctx, QScriptEngine *eng)
  {
      qDebug() &lt;&lt; "QAction is called";
      if(ctx-&gt;isCalledAsConstructor())
      {
          QObject *parent = ctx-&gt;argument(0).toQObject();
          QAction *action = new QAction("Test",parent);
          return eng-&gt;newQObject(action, QScriptEngine::ScriptOwnership);
      } else {
          return QString("invalid call. Use new Constructor");
      }
  }
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc,argv);
      QScriptEngine engine;
      //Evaluating a simaple expresssion
      qDebug() &lt;&lt; engine.evaluate("1+2").toNumber();
      QPushButton button;
      QScriptValue buttonScript= engine.newQObject(&amp;button);
      engine.globalObject().setProperty("button", buttonScript);
      engine.evaluate("button.text ='Hello Text'; button.show()");
  
      //QAction Prototype
      ScriptAction qsAction ;
      QScriptValue script_proto = engine.newQObject(&amp;qsAction);
      engine.setDefaultPrototype(qMetaTypeId&lt;QAction*&gt;(), script_proto);
      QScriptValue ctor = engine.newFunction(qAction_Constructor , script_proto);
      QScriptValue metaObject = engine.newQMetaObject(&amp;QObject::staticMetaObject, ctor);
      engine.globalObject().setProperty("QSAction" , metaObject);
      engine.evaluate("var p = new QSAction(button);p.textChanged.connect(catchSignal);");
      engine.evaluate("function catchSignal(text) { print ('PROTOTYPE SIGNAL IS CALLED ',text); } p.setText('New String'); " );
      return app.exec();
  }
  </code></pre>