41 <<
"Uncaught exception at line"
42 <<
result.property(
"lineNumber").toInt()
43 <<
":" <<
result.toString();
The QJSEngine class provides an environment for evaluating JavaScript code.
QJSValue globalObject() const
Returns this engine's Global Object.
QJSValue newQObject(QObject *object)
Creates a JavaScript object that wraps the given QObject object, using JavaScriptOwnership.
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...
QJSValue newQMetaObject(const QMetaObject *metaObject)
The QJSValue class acts as a container for Qt/JavaScript data types.
bool toBool() const
Returns the boolean value of this QJSValue, using the conversion rules described in \l{ECMA-262} sect...
QJSValue call(const QJSValueList &args=QJSValueList()) const
Calls this QJSValue as a function, passing args as arguments to the function, and using the globalObj...
qint32 toInt() const
Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{...
void setProperty(const QString &name, const QJSValue &value)
Sets the value of this QJSValue's property with the given name to the given value.
QJSValue property(const QString &name) const
Returns the value of this QJSValue's property with the given name.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qDebug()<< engine.evaluate("myObject.dynamicProperty").toInt()
[1]