15engine.
evaluate(
"function fullName() { return this.firstName + ' ' + this.lastName; }");
The QJSEngine class provides an environment for evaluating JavaScript code.
QJSValue globalObject() const
Returns this engine's Global Object.
QJSValue newObject()
Creates a JavaScript object of class Object.
QJSValue evaluate(const QString &program, const QString &fileName=QString(), int lineNumber=1, QStringList *exceptionStackTrace=nullptr)
Evaluates program, using lineNumber as the base line number, and returns the result of the evaluation...
The QJSValue class acts as a container for Qt/JavaScript data types.
QJSValue call(const QJSValueList &args=QJSValueList()) const
Calls this QJSValue as a function, passing args as arguments to the function, and using the globalObj...
double toNumber() const
Returns the number value of this QJSValue, as defined in \l{ECMA-262} section 9.3,...
void setProperty(const QString &name, const QJSValue &value)
Sets the value of this QJSValue's property with the given name to the given value.
QString toString() const
Returns the string value of this QJSValue, as defined in \l{ECMA-262} section 9.8,...
QJSValue property(const QString &name) const
Returns the value of this QJSValue's property with the given name.
qDebug()<< fullName.call(who).toString()
[1]