I am very new to QtScript and I have used QScriptEngine::evaluate() to evaluate this script:
function render(node) {
var stream = node.getStream();
print("typeof stream "+typeof stream + "," + stream);
var test = stream.test();
}
function render(node) {
var stream = node.getStream();
print("typeof stream "+typeof stream + "," + stream);
var test = stream.test();
}
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:
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:
public slots:
int testmethod() {return 8;}
public slots:
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.
Bookmarks