7#include <QtQml/qtqmlglobal.h>
8#include <QtCore/qstring.h>
9#include <QtCore/qlist.h>
10#include <QtCore/qmetatype.h>
24 struct ExecutionEngine;
61 { std::swap(
d,
other.d);
return *
this; }
69#ifndef QT_NO_CAST_FROM_ASCII
81 bool isString()
const;
82 bool isUndefined()
const;
83#if QT_DEPRECATED_SINCE(6, 9)
85 bool isVariant() const;
87 bool isQObject()
const;
88 bool isQMetaObject()
const;
89 bool isObject()
const;
97 double toNumber()
const;
114 void setPrototype(
const QJSValue &prototype);
127 bool isCallable()
const;
132 ErrorType errorType()
const;
142#ifndef QT_NO_DATASTREAM
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QJSEngine class provides an environment for evaluating JavaScript code.
The QJSPrimitiveValue class operates on primitive types in JavaScript semantics.
The QJSValue class acts as a container for Qt/JavaScript data types.
SpecialValue
This enum is used to specify a single-valued type.
QJSValue & operator=(QJSValue &&other)
Move-assigns other to this QJSValue object.
QJSValue(QJSValue &&other)
Move constructor.
ObjectConversionBehavior
This enum is used to specify how JavaScript objects and symbols without an equivalent native Qt type ...
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
Q_QML_EXPORT QDataStream & operator<<(QDataStream &, const QJSValue &)
Q_QML_EXPORT QDataStream & operator>>(QDataStream &, QJSValue &)
QList< QJSValue > QJSValueList
static bool isNumber(char s)
#define QT_DEPRECATED_VERSION_X_6_9(text)
#define QT_ASCII_CAST_WARN
unsigned long long quint64
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, JSToQVariantConversionBehavior conversionBehavior, V4ObjectSet *visitedObjects)
static int toInt(const QChar &qc, int R)
static bool isRegExp(ExecutionEngine *e, const QV4::Value *arg)
char * toString(const MyType &t)
[31]
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)
QT_BEGIN_NAMESPACE bool toBool(const QString &str)