I am very new to QtScript and I have used QScriptEngine::evaluate() to evaluate this script:

Qt Code:
  1. function render(node) {
  2. var stream = node.getStream();
  3. print("typeof stream "+typeof stream + "," + stream);
  4. var test = stream.test();
  5. }
To copy to clipboard, switch view to plain text mode 

Now, I have used Q_DECLARE_METATYPE(Stream*)
and node.getStream() returns Stream*

In the script the output is as follows:

Qt Code:
  1. typeof stream object,QVariant(Stream*)
To copy to clipboard, switch view to plain text mode 

Stream has a public slot with testmethod() returning an int:

Qt Code:
  1. public slots:
  2. int testmethod() {return 8;}
To copy to clipboard, switch view to plain text mode 

But then I get the following TypeError in the script when I try to access the testmethod() method of Stream

TypeError: Result of expression 'stream.testmethod' [undefined] is not a function.

I am obviously not doing this right? Can someone help me in the right direction to make this work?

Many thanks.