I am using an example provide by Qtcreator and getting this error... ??
void MainWindow::hBtn
{
QScriptEngine e;
QScriptValue fun = e.newFunction(myAdd); // ERROR: No matching function...
e.globalObject().setProperty("myAdd", fun);
QScriptValue result = e.evaluate("myAdd(myNumber, 1)");
}
QScriptValue myAdd(QScriptContext *context, QScriptEngine *engine)
//also tried: QScriptValue MainWindow::myAdd(QScriptContext *context, QScriptEngine *engine) //fails as well with same ERROR
{
QScriptValue a = context->argument(0);
QScriptValue b = context->argument(1);
return a.toNumber() + b.toNumber();
}
Example: http://harmattan-dev.nokia.com/docs/library/html/qt4/qscriptengine.html
scroll down to "Native Functions"
Looked through another user having problems with no solution either: Using a member function with QScriptEngine::newFunction