The QJSEngine class provides an environment for evaluating JavaScript code.
bool hasError() const
Returns true if the last JavaScript execution resulted in an exception or if throwError() was called.
QJSValue catchError()
If an exception is currently pending, catches it and returns it as a QJSValue.
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 property(const QString &name) const
Returns the property name of this QJSManagedValue.
The QJSValue class acts as a container for Qt/JavaScript data types.
qint32 toInt() const
Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{...
QJSValue property(const QString &name) const
Returns the value of this QJSValue's property with the given name.
qDebug()<< engine.hasError()
[1]
QJSManagedValue managed(std::move(val), &engine)
QJSEngine engine
[qjs-engine-example]