Thanks for the information.
But the class member functions should be available in the javascript functions like
ex:
function Add(myObj)
{
myObj.display();
}
function Add(myObj)
{
myObj.display();
}
To copy to clipboard, switch view to plain text mode
In the above myObj is the C++ object passed from QScriptEngine.
ex:
QScriptValue ctor = engine.evaluate("Add");
qint16 val = ctor.toInteger();
QScriptValue scriptUi = engine.newQObject(obj, QScriptEngine::ScriptOwnership);
str = scriptUi.toString();
QScriptValue calc = ctor.construct(QScriptValueList() << scriptUi);
str = calc.toString();
QObject *obj = new Sample();
QScriptValue ctor = engine.evaluate("Add");
qint16 val = ctor.toInteger();
QString str1 = ctor.toString();
QScriptValue scriptUi = engine.newQObject(obj, QScriptEngine::ScriptOwnership);
str = scriptUi.toString();
QScriptValue calc = ctor.construct(QScriptValueList() << scriptUi);
str = calc.toString();
To copy to clipboard, switch view to plain text mode
C++ class:
=======
{
public:
int data;
Sample(){
data = 100;
}
int display()
{
return data;
}
};
class Sample: public QObject
{
public:
int data;
Sample(){
data = 100;
}
int display()
{
return data;
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks