Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qv4qmlcontext.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qv4qmlcontext_p.h"
5
6#include <private/qjsvalue_p.h>
7#include <private/qqmlcontext_p.h>
8#include <private/qqmlengine_p.h>
9#include <private/qqmlglobal_p.h>
10#include <private/qqmljavascriptexpression_p.h>
11#include <private/qqmllistwrapper_p.h>
12#include <private/qqmltypewrapper_p.h>
13#include <private/qv4compileddata_p.h>
14#include <private/qv4engine_p.h>
15#include <private/qv4function_p.h>
16#include <private/qv4identifiertable_p.h>
17#include <private/qv4lookup_p.h>
18#include <private/qv4mm_p.h>
19#include <private/qv4module_p.h>
20#include <private/qv4objectproto_p.h>
21#include <private/qv4qobjectwrapper_p.h>
22#include <private/qv4stackframe_p.h>
23#include <private/qv4value_p.h>
24
25#include <QtCore/qloggingcategory.h>
26
28
29Q_LOGGING_CATEGORY(lcQmlContext, "qt.qml.context");
30
31using namespace QV4;
32
35
36void Heap::QQmlContextWrapper::init(QQmlRefPointer<QQmlContextData> context, QObject *scopeObject)
37{
38 Object::init();
39 this->context = context.take();
40 this->scopeObject.init(scopeObject);
41}
42
43void Heap::QQmlContextWrapper::destroy()
44{
45 context->release();
46 context = nullptr;
47 scopeObject.destroy();
48 Object::destroy();
49}
50
53 bool *hasProperty, Value *base, QV4::Lookup *lookup, QV4::Lookup *originalLookup,
55{
56 const int propertyIdx = context->propertyIndex(name);
57
58 if (propertyIdx == -1)
59 return OptionalReturnedValue();
60
61 if (propertyIdx < context->numIdValues()) {
62 if (hasProperty)
63 *hasProperty = true;
64
65 if (lookup) {
66 lookup->qmlContextIdObjectLookup.objectId = propertyIdx;
68 return OptionalReturnedValue(lookup->qmlContextPropertyGetter(lookup, v4, base));
69 } else if (originalLookup) {
71 }
72
73 if (ep->propertyCapture)
74 ep->propertyCapture->captureProperty(context->idValueBindings(propertyIdx));
75 return OptionalReturnedValue(QV4::QObjectWrapper::wrap(v4, context->idValue(propertyIdx)));
76 }
77
78 QQmlContextPrivate *cp = context->asQQmlContextPrivate();
79
80 if (ep->propertyCapture)
81 ep->propertyCapture->captureProperty(context->asQQmlContext(), -1, propertyIdx + cp->notifyIndex());
82
83 const QVariant &value = cp->propertyValue(propertyIdx);
84 if (hasProperty)
85 *hasProperty = true;
86 if (value.userType() == qMetaTypeId<QList<QObject*> >()) {
87 QQmlListProperty<QObject> prop(context->asQQmlContext(), (void*) qintptr(propertyIdx),
91 }
92 return OptionalReturnedValue(v4->fromVariant(cp->propertyValue(propertyIdx)));
93}
94
95template<typename Lookup>
96bool performLookup(ScopedValue *result, bool *hasProperty, const Lookup &lookup) {
97 bool hasProp = false;
98 *result = lookup(&hasProp);
99 if (hasProp) {
100 if (hasProperty)
101 *hasProperty = hasProp;
102 return true;
103 }
104 return false;
105}
106
107static QV4::QObjectWrapper::Flags getQmlPropertyFlags(const Lookup *l)
108{
109 return (l && l->forCall)
112}
113
114ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *resource, PropertyKey id, const Value *receiver, bool *hasProperty, Value *base, Lookup *lookup)
115{
116 if (!id.isString())
117 return Object::virtualGet(resource, id, receiver, hasProperty);
118
119 QV4::ExecutionEngine *v4 = resource->engine();
120 QV4::Scope scope(v4);
121
122 if (v4->callingQmlContext().data() != resource->d()->context) {
123 if (resource->d()->module) {
124 Scoped<Module> module(scope, resource->d()->module);
125 bool hasProp = false;
126 ScopedValue value(scope, module->get(id, receiver, &hasProp));
127 if (hasProp) {
128 if (hasProperty)
129 *hasProperty = hasProp;
130 return value->asReturnedValue();
131 }
132 }
133
134 return Object::virtualGet(resource, id, receiver, hasProperty);
135 }
136
137 ScopedValue result(scope);
138
139 // It's possible we could delay the calculation of the "actual" context (in the case
140 // of sub contexts) until it is definitely needed.
142 QQmlRefPointer<QQmlContextData> expressionContext = context;
143
144 if (!context) {
145 if (hasProperty)
146 *hasProperty = true;
147 return result->asReturnedValue();
148 }
149
150 // Search type (attached property/enum/imported scripts) names
151 // while (context) {
152 // Search context properties
153 // Search scope object
154 // Search context object
155 // context = context->parent
156 // }
157
158 QObject *scopeObject = resource->getScopeObject();
159
160 ScopedString name(scope, id.asStringOrSymbol());
161
162 const auto globalLookup = [v4, &name](bool *hasProp) {
163 return v4->globalObject->get(name, hasProp);
164 };
165
166 const auto jsLookup = [resource, &id, receiver](bool *hasProp) {
167 return Object::virtualGet(resource, id, receiver, hasProp);
168 };
169
170 const bool isJSContext = context->isJSContext();
171
172 // Do the generic JS lookup early in case of a JavaScript context.
173 if (isJSContext && performLookup(&result, hasProperty, jsLookup))
174 return result->asReturnedValue();
175
176 // If the scope object is a QAbstractDynamicMetaObject, then QMetaObject::indexOfProperty
177 // will call createProperty() on the QADMO and implicitly create the property. While that
178 // is questionable behavior, there are two use-cases that we support in the light of this:
179 //
180 // (1) The implicit creation of properties is necessary because it will also result in
181 // a recorded capture, which will allow a re-evaluation of bindings when the value
182 // is populated later. See QTBUG-35233 and the test-case in tst_qqmlpropertymap.
183 //
184 // (1) Looking up "console" in order to place a console.log() call for example must
185 // find the console instead of creating a new property. Therefore we prioritize the
186 // lookup in the global object here.
187 //
188 // Note: The scope object is only a QADMO for example when somebody registers a QQmlPropertyMap
189 // sub-class as QML type and then instantiates it in .qml.
190 const QMetaObjectPrivate *metaObjectPrivate = scopeObject
191 ? reinterpret_cast<const QMetaObjectPrivate *>(scopeObject->metaObject()->d.data)
192 : nullptr;
193 if (metaObjectPrivate && metaObjectPrivate->flags & DynamicMetaObject) {
194 // all bets are off, so don't try to optimize any lookups
195 lookup = nullptr;
196 if (performLookup(&result, hasProperty, globalLookup))
197 return result->asReturnedValue();
198 }
199
200 if (context->imports() && (name->startsWithUpper() || context->valueTypesAreAddressable())) {
201 // Search for attached properties, enums and imported scripts
203
204 if (r.isValid()) {
205 if (hasProperty)
206 *hasProperty = true;
207 if (r.scriptIndex != -1) {
208 if (lookup) {
209 lookup->qmlContextScriptLookup.scriptIndex = r.scriptIndex;
211 return lookup->qmlContextPropertyGetter(lookup, v4, base);
212 }
213 QV4::ScopedObject scripts(scope, context->importedScripts().valueRef());
214 if (scripts)
215 return scripts->get(r.scriptIndex);
216 return QV4::Encode::null();
217 } else if (r.type.isValid()) {
218 if (lookup) {
219 bool isValueSingleton = false;
220 if (r.type.isSingleton()) {
222 if (r.type.isQObjectSingleton() || r.type.isCompositeSingleton()) {
223 e->singletonInstance<QObject*>(r.type);
226 QQmlTypeWrapper::create(v4, nullptr, r.type)
227 ).heapObject();
228 } else {
229 QJSValue singleton = e->singletonInstance<QJSValue>(r.type);
230
231 // QSrting values should already have been put on the engine heap at this point
232 // to manage their memory. We later assume this has already happened.
234
236 lookup->qmlContextSingletonLookup.singletonObject = val->heapObject();
237 } else {
239 isValueSingleton = true;
240 }
241 }
244 return lookup->qmlContextPropertyGetter(lookup, v4, base);
245 }
246 }
247 result = QQmlTypeWrapper::create(v4, scopeObject, r.type);
248 } else if (r.importNamespace) {
249 result = QQmlTypeWrapper::create(v4, scopeObject, context->imports(), r.importNamespace);
250 }
251 if (lookup) {
252 lookup->qmlTypeLookup.qmlTypeWrapper = result->heapObject();
254 }
255 return result->asReturnedValue();
256 }
257
258 // Fall through
259 }
260
262 Lookup * const originalLookup = lookup;
263
264 decltype(lookup->qmlContextPropertyGetter) contextGetterFunction = QQmlContextWrapper::lookupContextObjectProperty;
265
266 // minor optimization so we don't potentially try two property lookups on the same object
267 if (scopeObject == context->contextObject()) {
268 scopeObject = nullptr;
269 contextGetterFunction = QQmlContextWrapper::lookupScopeObjectProperty;
270 }
271
272 while (context) {
273 if (auto property = searchContextProperties(v4, context, name, hasProperty, base, lookup, originalLookup, ep))
274 return *property;
275
276 // Search scope object
277 if (scopeObject) {
278 bool hasProp = false;
279
280 const QQmlPropertyData *propertyData = nullptr;
281
282 QV4::ScopedObject wrapper(scope, QV4::QObjectWrapper::wrap(v4, scopeObject));
284 v4, context, wrapper->d(), scopeObject, name,
285 getQmlPropertyFlags(lookup), &hasProp, &propertyData));
286 if (hasProp) {
287 if (hasProperty)
288 *hasProperty = true;
289 if (base)
290 *base = wrapper;
291
292 if (lookup && propertyData) {
293 QQmlData *ddata = QQmlData::get(scopeObject, false);
294 if (ddata && ddata->propertyCache) {
296 scope,
298 QV4::QObjectWrapper::wrap(v4, scopeObject)));
301 lookup, ddata, propertyData, val->objectValue(),
302 method->d());
305 } else {
307 lookup, ddata, propertyData, val->objectValue());
310 }
311 }
312 }
313
314 return result->asReturnedValue();
315 }
316 }
317 scopeObject = nullptr;
318
319
320 // Search context object
321 if (QObject *contextObject = context->contextObject()) {
322 bool hasProp = false;
323 const QQmlPropertyData *propertyData = nullptr;
324 QV4::ScopedObject wrapper(scope, QV4::QObjectWrapper::wrap(v4, contextObject));
326 v4, context, wrapper->d(), contextObject, name, getQmlPropertyFlags(lookup),
327 &hasProp, &propertyData);
328 if (hasProp) {
329 if (hasProperty)
330 *hasProperty = true;
331 if (base)
332 *base = wrapper;
333
334 if (propertyData) {
335 if (lookup) {
336 QQmlData *ddata = QQmlData::get(contextObject, false);
337 if (ddata && ddata->propertyCache
338 && lookup->qmlContextPropertyGetter != contextGetterFunction) {
340 scope,
342 QV4::QObjectWrapper::wrap(v4, contextObject)));
345 lookup, ddata, propertyData, val->objectValue(),
346 method->d());
347 if (contextGetterFunction == lookupScopeObjectProperty)
349 else
351 } else {
353 lookup, ddata, propertyData, val->objectValue());
354 lookup->qmlContextPropertyGetter = contextGetterFunction;
355 }
356 }
357 } else if (originalLookup) {
359 }
360 }
361
362 return result->asReturnedValue();
363 }
364 }
365
366 context = context->parent();
367
368 // As the hierarchy of contexts is not stable, we can't do accelerated lookups beyond
369 // the immediate QML context (of the .qml file).
370 lookup = nullptr;
371 }
372
373 // Do the generic JS lookup late in case of a non-JavaScript context.
374 // The scope, context, types etc should be able to override it.
375 if (!isJSContext && performLookup(&result, hasProperty, jsLookup))
376 return result->asReturnedValue();
377
378 // Do a lookup in the global object here to avoid expressionContext->unresolvedNames becoming
379 // true if we access properties of the global object.
380 if (originalLookup) {
381 // Try a lookup in the global object. It's theoretically possible to first find a property
382 // in the global object and then later a context property with the same name is added, but that
383 // never really worked as we used to detect access to global properties at type compile time anyway.
384 lookup = originalLookup;
385 result = lookup->resolveGlobalGetter(v4);
387 if (hasProperty)
388 *hasProperty = true;
391 return result->asReturnedValue();
392 }
394 } else {
395 if (performLookup(&result, hasProperty, globalLookup))
396 return result->asReturnedValue();
397 }
398
399 expressionContext->setUnresolvedNames(true);
400
401 return Encode::undefined();
402}
403
404ReturnedValue QQmlContextWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
405{
407 const QQmlContextWrapper *This = static_cast<const QQmlContextWrapper *>(m);
408 return getPropertyAndBase(This, id, receiver, hasProperty, /*base*/nullptr);
409}
410
412{
414
415 if (id.isSymbol() || id.isArrayIndex())
416 return Object::virtualPut(m, id, value, receiver);
417
418 QQmlContextWrapper *resource = static_cast<QQmlContextWrapper *>(m);
419 ExecutionEngine *v4 = resource->engine();
420 QV4::Scope scope(v4);
421 if (scope.hasException())
422 return false;
424
425 auto member = wrapper->internalClass()->findValueOrSetter(id);
426 if (member.index < UINT_MAX)
427 return wrapper->putValue(member.index, member.attrs, value);
428
429 // It's possible we could delay the calculation of the "actual" context (in the case
430 // of sub contexts) until it is definitely needed.
432 QQmlRefPointer<QQmlContextData> expressionContext = context;
433
434 if (!context)
435 return false;
436
437 // See QV8ContextWrapper::Getter for resolution order
438
439 QObject *scopeObject = wrapper->getScopeObject();
440 ScopedString name(scope, id.asStringOrSymbol());
441
442 while (context) {
443 // Search context properties
444 if (const int propertyIndex = context->propertyIndex(name); propertyIndex != -1) {
445 if (propertyIndex < context->numIdValues()) {
446 v4->throwError(QLatin1String("left-hand side of assignment operator is not an lvalue"));
447 return false;
448 }
449 return false;
450 }
451
452 // Search scope object
453 if (scopeObject &&
455 return true;
456 scopeObject = nullptr;
457
458 // Search context object
459 if (context->contextObject() &&
462 return true;
463
464 context = context->parent();
465 }
466
467 expressionContext->setUnresolvedNames(true);
468
469 QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
470 QLatin1Char('"');
471 v4->throwError(error);
472 return false;
473}
474
476{
477 Scope scope(engine);
480 func->compilationUnit->runtimeStrings[l->nameIndex]);
481
482 // Special hack for bounded signal expressions, where the parameters of signals are injected
483 // into the handler expression through the locals of the call context. So for onClicked: { ... }
484 // the parameters of the clicked signal are injected and we must allow for them to be found here
485 // before any other property from the QML context.
486 for (Heap::ExecutionContext *ctx = engine->currentContext()->d(); ctx; ctx = ctx->outer) {
487 if (ctx->type == Heap::ExecutionContext::Type_CallContext) {
488 const uint index = ctx->internalClass->indexOfValueOrGetter(name);
489 if (index < std::numeric_limits<uint>::max()) {
490 if (!func->detectedInjectedParameters) {
491 const auto location = func->sourceLocation();
492 qCWarning(lcQmlContext).nospace().noquote()
493 << location.sourceFile << ":" << location.line << ":" << location.column
494 << " Parameter \"" << name.toQString() << "\" is not declared."
495 << " Injection of parameters into signal handlers is deprecated."
496 << " Use JavaScript functions with formal parameters instead.";
497
498 // Don't warn over and over for the same function
499 func->detectedInjectedParameters = true;
500 }
501
502 return static_cast<Heap::CallContext *>(ctx)->locals[index].asReturnedValue();
503 }
504 }
505
506 // Skip only block and call contexts.
507 // Other contexts need a regular QML property lookup. See below.
508 if (ctx->type != Heap::ExecutionContext::Type_BlockContext && ctx->type != Heap::ExecutionContext::Type_CallContext)
509 break;
510 }
511
512 bool hasProperty = false;
513 ScopedValue result(scope);
514
515 Scoped<QmlContext> callingQmlContext(scope, engine->qmlContext());
516 if (callingQmlContext) {
517 Scoped<QQmlContextWrapper> qmlContextWrapper(scope, callingQmlContext->d()->qml());
519 qmlContextWrapper, name, /*receiver*/nullptr, &hasProperty, base, l);
520 } else {
521 // Code path typical to worker scripts, compiled with lookups but no qml context.
524 hasProperty = true;
527 }
528 }
529 if (!hasProperty)
530 return engine->throwReferenceError(name.toQString());
531 return result->asReturnedValue();
532}
533
535{
536 Q_UNUSED(base);
537 Scope scope(engine);
539 if (!qmlContext)
540 return QV4::Encode::null();
541
543 if (!context)
544 return QV4::Encode::null();
545
546 QV4::ScopedObject scripts(scope, context->importedScripts().valueRef());
547 if (!scripts)
548 return QV4::Encode::null();
549 return scripts->get(l->qmlContextScriptLookup.scriptIndex);
550}
551
553{
555 Q_UNUSED(base);
556
558}
559
561{
563 Q_UNUSED(base);
564
567}
568
570{
571 Q_UNUSED(base);
572 Scope scope(engine);
574 if (!qmlContext)
575 return QV4::Encode::null();
576
578 if (!context)
579 return QV4::Encode::null();
580
582 const int objectId = l->qmlContextIdObjectLookup.objectId;
583
584 if (qmlEngine->propertyCapture)
585 qmlEngine->propertyCapture->captureProperty(context->idValueBindings(objectId));
586
587 return QV4::QObjectWrapper::wrap(engine, context->idValue(objectId));
588}
589
592{
594}
595
597{
599 l->qobjectLookup.propertyCache = nullptr;
602}
603
605{
610}
611
612template<typename Call>
614{
615 Scope scope(engine);
616 Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
617 if (!qmlContext)
618 return QV4::Encode::undefined();
619
620 QObject *scopeObject = qmlContext->qmlScope();
621 if (!scopeObject)
622 return QV4::Encode::undefined();
623
624 if (QQmlData::wasDeleted(scopeObject))
625 return QV4::Encode::undefined();
626
627 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, scopeObject));
628
629 if (base)
630 *base = obj;
631
632 return c(obj);
633}
634
636{
637 return callWithScopeObject(engine, base, [l, engine, base](const Value &obj) {
638 const QObjectWrapper::Flags flags = l->forCall
643 });
644 });
645}
646
648{
649 return callWithScopeObject(engine, base, [l, engine, base](const Value &obj) {
650 const QObjectWrapper::Flags flags = l->forCall
655 });
656 });
657}
658
659template<typename Call>
661{
662 Scope scope(engine);
663 Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
664 if (!qmlContext)
665 return QV4::Encode::undefined();
666
668 if (!context)
669 return QV4::Encode::undefined();
670
671 QObject *contextObject = context->contextObject();
672 if (!contextObject)
673 return QV4::Encode::undefined();
674
675 if (QQmlData::wasDeleted(contextObject))
676 return QV4::Encode::undefined();
677
678 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, contextObject));
679
680 if (base)
681 *base = obj;
682
683 return c(obj);
684}
685
688{
689 return callWithContextObject(engine, base, [l, engine, base](const Value &obj) {
690 const QObjectWrapper::Flags flags = l->forCall
695 });
696 });
697}
698
701{
702 return callWithContextObject(engine, base, [l, engine, base](const Value &obj) {
703 const QObjectWrapper::Flags flags = l->forCall
708 });
709 });
710}
711
713{
715}
716
718{
719 Q_UNUSED(base);
721 // In the unlikely event of mutation of the global object, update the trampoline.
725 }
726 return result;
727}
728
730{
731 Scope scope(engine);
733 if (!qmlContext)
734 return QV4::Encode::undefined();
735
737 if (!context)
738 return QV4::Encode::undefined();
739
740 QQmlRefPointer<QQmlContextData> expressionContext = context;
741
743
745 runtimeStrings[l->nameIndex]);
746 ScopedString name(scope, id.asStringOrSymbol());
747
748 ScopedValue result(scope);
749
750 for (context = context->parent(); context; context = context->parent()) {
751 if (auto property = searchContextProperties(engine, context, name, nullptr, base, nullptr, nullptr, ep))
752 return *property;
753
754 // Search context object
755 if (QObject *contextObject = context->contextObject()) {
756 bool hasProp = false;
759 engine, context, wrapper->d(), contextObject, name, getQmlPropertyFlags(l),
760 &hasProp);
761 if (hasProp) {
762 if (base)
763 *base = wrapper;
764
765 return result->asReturnedValue();
766 }
767 }
768 }
769
770 bool hasProp = false;
771 result = engine->globalObject->get(name, &hasProp);
772 if (hasProp)
773 return result->asReturnedValue();
774
775 expressionContext->setUnresolvedNames(true);
776
777 return Encode::undefined();
778}
779
781{
782 Scope scope(engine);
784 if (!qmlContext)
785 return QV4::Encode::undefined();
786
787 QObject *scopeObject = qmlContext->qmlScope();
788 if (scopeObject && QQmlData::wasDeleted(scopeObject))
789 return QV4::Encode::undefined();
790
792 if (static_cast<Heap::QQmlTypeWrapper *>(heapObject)->object != scopeObject) {
793 l->qmlTypeLookup.qmlTypeWrapper = nullptr;
796 }
797
799}
800
801void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QQmlContextWrapper *qml)
802{
803 Heap::ExecutionContext::init(Heap::ExecutionContext::Type_QmlContext);
804 outer.set(internalClass->engine, outerContext->d());
805
806 this->activation.set(internalClass->engine, qml->d());
807}
808
809Heap::QmlContext *QmlContext::create(
811 QObject *scopeObject)
812{
813 Scope scope(parent);
814
817 std::move(context), scopeObject));
818 Heap::QmlContext *c = scope.engine->memoryManager->alloc<QmlContext>(parent, qml);
819 Q_ASSERT(c->vtable() == staticVTable());
820 return c;
821}
822
static QV4::Value * takeManagedValue(QJSValue *jsval)
Definition qjsvalue_p.h:207
static QV4::ReturnedValue asReturnedValue(const QJSValue *jsval)
Definition qjsvalue_p.h:249
static const QString * asQString(const QJSValue *jsval)
Definition qjsvalue_p.h:240
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
Definition qlist.h:74
static constexpr QMetaType fromType()
Definition qmetatype.h:2612
\inmodule QtCore
Definition qobject.h:90
static qsizetype context_count(QQmlListProperty< QObject > *)
int notifyIndex() const
QVariant propertyValue(int index) const
static QObject * context_at(QQmlListProperty< QObject > *, qsizetype)
QQmlPropertyCache::ConstPtr propertyCache
Definition qqmldata_p.h:195
static bool wasDeleted(const QObject *)
Definition qqmldata_p.h:312
static QQmlData * get(QObjectPrivate *priv, bool create)
Definition qqmldata_p.h:199
QQmlPropertyCapture * propertyCapture
static QQmlEnginePrivate * get(QQmlEngine *e)
void captureProperty(QObject *object, const QMetaProperty &property) const
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
void captureProperty(QQmlNotifier *)
void release() const
T * data() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
ObjectType::Data * allocate(Args &&... args)
Definition qv4mm_p.h:199
ManagedType::Data * alloc(Args &&... args)
Definition qv4mm_p.h:208
\inmodule QtCore
Definition qvariant.h:64
EGLContext ctx
double e
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
quint64 ReturnedValue
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
void setupQObjectMethodLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self, Heap::QObjectMethod *method)
static void * context
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
@ DynamicMetaObject
constexpr int qMetaTypeId()
Definition qmetatype.h:1384
GLint location
const GLfloat * m
GLuint index
[2]
GLboolean r
[2]
GLenum GLuint id
[7]
GLbitfield flags
GLuint name
GLhandleARB obj
[2]
GLenum func
Definition qopenglext.h:663
const GLubyte * c
GLuint GLfloat * val
GLuint64EXT * result
[6]
QQmlEngine * qmlEngine(const QObject *obj)
Definition qqml.cpp:76
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:71
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define Q_UNUSED(x)
unsigned int uint
Definition qtypes.h:29
ptrdiff_t qintptr
Definition qtypes.h:71
static ReturnedValue revertObjectMethodLookup(Lookup *l, ExecutionEngine *engine, Value *base)
static QV4::QObjectWrapper::Flags getQmlPropertyFlags(const Lookup *l)
static ReturnedValue revertObjectPropertyLookup(Lookup *l, ExecutionEngine *engine, Value *base)
static OptionalReturnedValue searchContextProperties(QV4::ExecutionEngine *v4, const QQmlRefPointer< QQmlContextData > &context, String *name, bool *hasProperty, Value *base, QV4::Lookup *lookup, QV4::Lookup *originalLookup, QQmlEnginePrivate *ep)
ReturnedValue callWithScopeObject(ExecutionEngine *engine, Value *base, Call c)
ReturnedValue callWithContextObject(ExecutionEngine *engine, Value *base, Call c)
bool performLookup(ScopedValue *result, bool *hasProperty, const Lookup &lookup)
#define DEFINE_OBJECT_VTABLE(classname)
#define DEFINE_MANAGED_VTABLE(classname)
const char property[13]
Definition qwizard.cpp:101
QJSEngine engine
[0]
\inmodule QtCore \reentrant
Definition qchar.h:17
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
IdentifierTable * identifierTable
MemoryManager * memoryManager
CppStackFrame * currentStackFrame
QQmlRefPointer< QQmlContextData > callingQmlContext() const
ReturnedValue throwError(const Value &value)
ReturnedValue throwReferenceError(const Value &value)
QV4::ReturnedValue fromVariant(const QVariant &)
QQmlEngine * qmlEngine() const
static Heap::ExecutionContext * qmlContext(Heap::ExecutionContext *ctx)
ExecutionContext * currentContext() const
CompiledData::CompilationUnitBase * compilationUnit
ReturnedValue asReturnedValue() const
Definition qv4value_p.h:339
PropertyKey asPropertyKey(const Heap::String *str)
ReturnedValue(* globalGetter)(Lookup *l, ExecutionEngine *engine)
Definition qv4lookup_p.h:37
QV4::ReturnedValue singletonValue
struct QV4::Lookup::@576::@608 qmlContextGlobalLookup
struct QV4::Lookup::@576::@601 qobjectLookup
struct QV4::Lookup::@576::@606 qmlContextSingletonLookup
ReturnedValue resolveGlobalGetter(ExecutionEngine *engine)
Definition qv4lookup.cpp:89
Heap::Base * qmlTypeWrapper
ReturnedValue(* qmlContextPropertyGetter)(Lookup *l, ExecutionEngine *engine, Value *thisObject)
Definition qv4lookup_p.h:38
Heap::Base * singletonObject
static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionEngine *engine)
struct QV4::Lookup::@576::@605 qmlContextScriptLookup
ReturnedValue(* getterTrampoline)(Lookup *l, ExecutionEngine *engine)
struct QV4::Lookup::@576::@607 qmlContextIdObjectLookup
struct QV4::Lookup::@576::@609 qmlTypeLookup
struct QV4::Lookup::@576::@602 qobjectMethodLookup
const QQmlPropertyCache * propertyCache
Definition qv4lookup_p.h:95
Q_ALWAYS_INLINE Heap::Base * heapObject() const
ExecutionEngine * engine() const
const Value * propertyData(uint index) const
bool hasProperty(PropertyKey id) const
ReturnedValue get(StringOrSymbol *name, bool *hasProperty=nullptr, const Value *receiver=nullptr) const
static bool setQmlProperty(ExecutionEngine *engine, const QQmlRefPointer< QQmlContextData > &qmlContext, QObject *object, String *name, Flags flags, const Value &value)
ReturnedValue getQmlProperty(const QQmlRefPointer< QQmlContextData > &qmlContext, String *name, Flags flags, bool *hasProperty=nullptr) const
static ReturnedValue lookupPropertyGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static ReturnedValue lookupMethodGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue lookupScopeObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupSingleton(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupInParentContextHierarchy(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupContextObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue getPropertyAndBase(const QQmlContextWrapper *resource, PropertyKey id, const Value *receiver, bool *hasProperty, Value *base, Lookup *lookup=nullptr)
QQmlRefPointer< QQmlContextData > getContext() const
static ReturnedValue lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
V4_NEEDS_DESTROY QObject * getScopeObject() const
static ReturnedValue lookupIdObjectInParentContext(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupIdObject(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue resolveQmlContextPropertyLookupGetter(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupValueSingleton(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeFallbackProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupInGlobalObject(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupType(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScript(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlType &, Heap::QQmlTypeWrapper::TypeNameMode=Heap::QQmlTypeWrapper::IncludeEnums)
static Heap::QmlContext * create(QV4::ExecutionContext *parent, QQmlRefPointer< QQmlContextData > context, QObject *scopeObject)
static V4_NEEDS_DESTROY ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType)
bool hasException() const
ExecutionEngine * engine
constexpr ReturnedValue asReturnedValue() const
static constexpr VTable::Get virtualGet
static constexpr VTable::Put virtualPut
bool isString() const
Definition qv4value_p.h:284
QML_NEARLY_ALWAYS_INLINE Object * objectValue() const
Definition qv4value_p.h:70
static Value fromHeapObject(HeapBasePtr m)
Definition qv4value_p.h:84
static constexpr Value fromReturnedValue(ReturnedValue val)
Definition qv4value_p.h:165
QML_NEARLY_ALWAYS_INLINE Value::HeapBasePtr heapObject() const
Definition qv4value_p.h:80
bool isSymbol() const
Definition qv4value_p.h:296
void wrapper()
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent