7#include <private/qqmlexpression_p.h>
8#include <private/qv4context_p.h>
9#include <private/qv4value_p.h>
10#include <private/qv4functionobject_p.h>
11#include <private/qv4script_p.h>
12#include <private/qv4errorobject_p.h>
13#include <private/qv4scopedvalue_p.h>
14#include <private/qv4jscall_p.h>
15#include <private/qqmlglobal_p.h>
16#include <private/qv4qobjectwrapper_p.h>
17#include <private/qqmlbuiltinfunctions_p.h>
18#include <private/qqmlsourcecoordinate_p.h>
19#include <private/qqmlabstractbinding_p.h>
20#include <private/qqmlpropertybinding_p.h>
21#include <private/qproperty_p.h>
29 if (
e->inProgressCreations == 0)
return false;
31 if (prevError)
return true;
33 prevError = &
e->erroredBindings;
34 nextError =
e->erroredBindings;
35 e->erroredBindings =
this;
36 if (nextError) nextError->prevError = &nextError;
60 m_error =
engine->catchExceptionAsQmlError();
74 if (m_prevExpression) {
75 *m_prevExpression = m_nextExpression;
77 m_nextExpression->m_prevExpression = m_prevExpression;
96 uint lineNumber =
f->compiledFunction->location.line();
97 uint columnNumber =
f->compiledFunction->location.column();
125 if (m_prevExpression) {
126 *m_prevExpression = m_nextExpression;
127 if (m_nextExpression)
128 m_nextExpression->m_prevExpression = m_prevExpression;
129 m_prevExpression =
nullptr;
130 m_nextExpression =
nullptr;
163 : watcher(expression)
164 , capture(
engine, expression, &watcher)
179 for (
int ii = 0; ii < capture.
errorString->size(); ++ii)
246 }
else if (isUndefined) {
247 *isUndefined =
result->isUndefined();
250 return result->asReturnedValue();
315 const QMetaObject *metaObjectForBindable =
nullptr;
318 if (propCache->property(
c)->isBindable())
319 metaObjectForBindable = propCache->metaObject();
322 if (
m->property(
c).isBindable())
323 metaObjectForBindable =
m;
325 if (metaObjectForBindable) {
326 captureBindableProperty(
o, metaObjectForBindable,
c);
345 captureBindableProperty(
o, metaObjectForBindable, propertyData->
coreIndex());
359 *prev = current->
next;
365 prev = ¤t->
next;
366 current = current->
next;
377 int const invalidIndex = -2;
384void QQmlPropertyCapture::captureBindableProperty(
395 void *argv[] = { &bindable };
401void QQmlPropertyCapture::captureNonBindableProperty(
QObject *
o,
int n,
int c,
bool doNotify)
474 if (
error.description().isEmpty())
476 if (
error.line() == -1)
478 if (
error.url().isEmpty())
484 return result->asReturnedValue();
502 error->catchJavaScriptException(v4);
503 error->setErrorObject(qmlScope);
504 if (!
error->addError(ep))
522 m_compilationUnit = compilationUnit;
534 auto const mo =
target->metaObject();
544 trigger->propertyIndex = propertyIndex;
546 trigger->
next = oldHead;
void copyAndClearPrepend(QForwardFieldList< N, nextMember, OtherTag > &)
QV4::ExecutionEngine * handle() const
void setSource(const Property &property)
void addExpression(QQmlJavaScriptExpression *expression)
QQmlEngine * engine() const
Return the context's QQmlEngine, or \nullptr if the context has no QQmlEngine or the QQmlEngine was d...
QQmlPropertyCache::ConstPtr propertyCache
static QQmlData * get(QObjectPrivate *priv, bool create)
bool addError(QQmlEnginePrivate *)
void setErrorObject(QObject *object)
void catchJavaScriptException(QV4::ExecutionEngine *engine)
void setErrorLocation(const QQmlSourceLocation &sourceLocation)
const QQmlError & error() const
void setErrorDescription(const QString &description)
QQmlPropertyCapture * propertyCapture
void warning(const QQmlError &)
static QQmlEnginePrivate * get(QQmlEngine *e)
QRecyclePool< TriggerList > qPropertyTriggerPool
The QQmlEngine class provides an environment for instantiating QML components.
The QQmlError class encapsulates a QML error.
void setObject(QObject *)
Sets the nearest object where this error occurred.
void setColumn(int)
Sets the error column number.
void setLine(int)
Sets the error line number.
void setDescription(const QString &)
Sets the error description.
void setUrl(const QUrl &)
Sets the url for the file that caused this error.
bool catchException(const QV4::Scope &scope) const
~QQmlJavaScriptExpressionCapture()
QQmlJavaScriptExpressionCapture(QQmlJavaScriptExpression *expression, QQmlEngine *engine)
static QQmlJavaScriptExpressionGuard * New(QQmlJavaScriptExpression *e, QQmlEngine *engine)
void setNotifyOnValueChanged(bool v)
void setupFunction(QV4::ExecutionContext *qmlContext, QV4::Function *f)
QV4::Function * function() const
void setCompilationUnit(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit)
QQmlDelayedError * delayedError()
QObject * scopeObject() const
bool needsPropertyChangeTrigger(QObject *target, int propertyIndex)
QV4::ReturnedValue evaluate(bool *isUndefined)
QQmlJavaScriptExpression()
virtual QString expressionIdentifier() const
void createQmlBinding(const QQmlRefPointer< QQmlContextData > &ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line)
QForwardFieldList< QQmlJavaScriptExpressionGuard, &QQmlJavaScriptExpressionGuard::next, GuardTag > activeGuards
void setContext(const QQmlRefPointer< QQmlContextData > &context)
bool hasDelayedError() const
QQmlEngine * engine() const
QQmlRefPointer< QQmlContextData > context() const
static QV4::ReturnedValue evalFunction(const QQmlRefPointer< QQmlContextData > &ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line)
QQmlError error(QQmlEngine *) const
TriggerList * qpropertyChangeTriggers
void resetNotifyOnValueChanged()
virtual QQmlSourceLocation sourceLocation() const
virtual ~QQmlJavaScriptExpression()
QBiPointer< QObject, DeleteWatcher > m_scopeObject
virtual void expressionChanged()=0
QPropertyChangeTrigger * allocatePropertyChangeTrigger(QObject *target, int propertyIndex)
bool notifyOnValueChanged() const
virtual bool mustCaptureBindableProperty() const
QTaggedPointer< QQmlDelayedError, Tag > m_error
void cancelNotify()
Cancel any notifies that are in progress.
const QMetaObject * metaObject() const
QQmlJavaScriptExpression * expression
QStringList * errorString
void captureTranslation()
void captureProperty(QQmlNotifier *)
QForwardFieldList< QQmlJavaScriptExpressionGuard, &QQmlJavaScriptExpressionGuard::next > guards
QQmlJavaScriptExpression::DeleteWatcher * watcher
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
T * data() const noexcept
void observe(QPropertyObserver *observer) const
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
void set(ExecutionEngine *engine, const Value &value)
Combined button and popup list for selecting options.
static bool doNotify(QObject *, QEvent *)
DBusConnection const char DBusError * error
static QDBusError::ErrorType get(const char *name)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLsizei GLenum GLenum * types
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *e, void **)
int qmlConvertSourceCoordinate< quint16, int >(quint16 n)
#define qPrintable(string)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]
engine evaluate("var myObject = new MyObject()")
[8]
QPointer< QObject > target
QQmlJavaScriptExpression * m_expression
QMetaProperty property() const
static void trigger(QPropertyObserver *, QUntypedPropertyData *)
static constexpr ReturnedValue undefined()
ExecutionContext * rootContext() const
QQmlError catchExceptionAsQmlError()
ReturnedValue catchException(StackTrace *trace=nullptr)
QV4::ExecutableCompilationUnit * executableCompilationUnit() const
QQmlSourceLocation sourceLocation() const
bool call(QObject *thisObject, void **a, const QMetaType *types, int argc, ExecutionContext *context)
CallData * callData(const Scope &scope, const FunctionObject *f=nullptr) const
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static Heap::QmlContext * create(QV4::ExecutionContext *parent, QQmlRefPointer< QQmlContextData > context, QObject *scopeObject)
bool hasException() const
ReturnedValue run(const QV4::Value *thisObject=nullptr)
const Value & asValue() const
bool isNullOrUndefined() const