10#include <private/qqmlsourcecoordinate_p.h>
11#include <private/qv4qmlcontext_p.h>
13#include <QtCore/qdebug.h>
19 expressionFunctionValid(true),
108 if (!scriptPrivate) {
129 && !ctxtdata->urlString().isEmpty()
130 && ctxtdata->typeCompilationUnit()) {
131 d->url = ctxtdata->urlString();
136 runtimeFunction = ctxtdata->typeCompilationUnit()->runtimeFunctions.at(scriptPrivate->
bindingId);
140 if (runtimeFunction) {
141 d->expression = scriptPrivate->
script;
195 return d->publicContext();
204 return d->expression;
214 d->resetNotifyOnValueChanged();
216 d->expressionFunctionValid =
false;
240 qWarning(
"QQmlExpression: Attempted to evaluate an expression in an invalid context");
274 return d->value(valueIsUndefined);
284 return d->notifyOnValueChanged();
306 d->setNotifyOnValueChanged(notifyOnChange);
360 return d->scopeObject();
372 return d->hasError();
411 emit q->valueChanged();
421#include <moc_qqmlexpression.cpp>
QV4::ExecutionEngine * handle() const
static QQmlRefPointer< QQmlContextData > get(QQmlContext *context)
The QQmlContext class defines a context within a QML engine.
bool isValid() const
Returns whether the context is valid.
QQmlEngine * engine() const
Return the context's QQmlEngine, or \nullptr if the context has no QQmlEngine or the QQmlEngine was d...
static QQmlEnginePrivate * get(QQmlEngine *e)
void referenceScarceResources()
void dereferenceScarceResources()
The QQmlEngine class provides an environment for instantiating QML components.
QQmlContext * rootContext() const
Returns the engine's root context.
The QQmlError class encapsulates a QML error.
void expressionChanged() override
QV4::ReturnedValue v4value(bool *isUndefined=nullptr)
bool expressionFunctionValid
void init(const QQmlRefPointer< QQmlContextData > &, const QString &, QObject *)
QVariant value(bool *isUndefined=nullptr)
QString expressionIdentifier() const override
~QQmlExpressionPrivate() override
The QQmlExpression class evaluates JavaScript in a QML context.
QString sourceFile() const
Returns the source file URL for this expression.
~QQmlExpression() override
Destroy the QQmlExpression instance.
bool notifyOnValueChanged() const
Returns true if the valueChanged() signal is emitted when the expression's evaluated value changes.
QQmlContext * context() const
Returns the QQmlContext this expression is associated with, or \nullptr if there is no association or...
void clearError()
Clear any expression errors.
void setSourceLocation(const QString &fileName, int line, int column=0)
Set the location of this expression to line and column of url.
QString expression() const
Returns the expression string.
int columnNumber() const
Returns the source file column number for this expression.
int lineNumber() const
Returns the source file line number for this expression.
QQmlError error() const
Return any error from the last call to evaluate().
QQmlExpression()
Create an invalid QQmlExpression.
bool hasError() const
Returns true if the last call to evaluate() resulted in an error, otherwise false.
void setExpression(const QString &)
Set the expression to expression.
QVariant evaluate(bool *valueIsUndefined=nullptr)
Evaulates the expression, returning the result of the evaluation, or an invalid QVariant if the expre...
void setNotifyOnValueChanged(bool)
Sets whether the valueChanged() signal is emitted when the expression's evaluated value changes.
QQmlEngine * engine() const
Returns the QQmlEngine this expression is associated with, or \nullptr if there is no association or ...
QObject * scopeObject() const
Returns the expression's scope object, if provided, otherwise 0.
void setupFunction(QV4::ExecutionContext *qmlContext, QV4::Function *f)
QObject * scopeObject() const
void createQmlBinding(const QQmlRefPointer< QQmlContextData > &ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line)
void setContext(const QQmlRefPointer< QQmlContextData > &context)
QQmlEngine * engine() const
QQmlRefPointer< QQmlContextData > context() const
bool hasValidContext() const
void setScopeObject(QObject *v)
The QQmlScriptString class encapsulates a script and its context.
T * data()
Returns a pointer to the shared data object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
QQmlContext * qmlContext(const QObject *obj)
quint16 qmlConvertSourceCoordinate< int, quint16 >(int n)
int qmlConvertSourceCoordinate< quint16, int >(quint16 n)
QUrl url("example.com")
[constructor-url-reference]
engine evaluate("var myObject = new MyObject()")
[8]
\inmodule QtCore \reentrant
static constexpr ReturnedValue undefined()
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols=true)
static Heap::QmlContext * create(QV4::ExecutionContext *parent, QQmlRefPointer< QQmlContextData > context, QObject *scopeObject)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent