Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmltypewrapper.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 "qqmltypewrapper_p.h"
5
6#include <private/qqmlengine_p.h>
7#include <private/qqmlcontext_p.h>
8#include <private/qqmlmetaobject_p.h>
9#include <private/qqmltypedata_p.h>
10#include <private/qqmlvaluetypewrapper_p.h>
11
12#include <private/qjsvalue_p.h>
13#include <private/qv4functionobject_p.h>
14#include <private/qv4objectproto_p.h>
15#include <private/qv4qobjectwrapper_p.h>
16#include <private/qv4identifiertable_p.h>
17#include <private/qv4lookup_p.h>
18
20
21using namespace QV4;
22
25
27{
28 Object::init();
30 object.init();
31}
32
34{
35 QQmlType::derefHandle(typePrivate);
36 typePrivate = nullptr;
37 if (typeNamespace)
38 typeNamespace->release();
39 object.destroy();
40 Object::destroy();
41}
42
44{
45 return QQmlType(typePrivate);
46}
47
49{
50 return d()->type().isSingleton();
51}
52
54{
55 const QQmlType type = d()->type();
56 if (!type.isValid())
57 return nullptr;
58
59 if (type.isSingleton())
60 return type.metaObject();
61
62 return type.attachedPropertiesType(QQmlEnginePrivate::get(engine()->qmlEngine()));
63}
64
66{
67 const QQmlType type = d()->type();
68 if (!type.isValid())
69 return nullptr;
70
72 if (type.isSingleton())
74
76 d()->object,
77 type.attachedPropertiesFunction(qmlEngine));
78}
79
81{
82 if (!isSingleton())
83 return nullptr;
84
86 return e->singletonInstance<QObject*>(d()->type());
87}
88
90{
92 const QQmlType type = d()->type();
93
94 if (!isSingleton()) {
96 d()->object, type.attachedPropertiesFunction(e)));
97 }
98
99 if (type.isQJSValueSingleton())
100 return QVariant::fromValue<QJSValue>(e->singletonInstance<QJSValue>(type));
101
102 return QVariant::fromValue<QObject*>(e->singletonInstance<QObject*>(type));
103}
104
105
106// Returns a type wrapper for type t on o. This allows access of enums, and attached properties.
109{
110 Q_ASSERT(t.isValid());
111 Scope scope(engine);
112
114 w->d()->mode = mode; w->d()->object = o;
115 w->d()->typePrivate = t.priv();
116 QQmlType::refHandle(w->d()->typePrivate);
117 return w.asReturnedValue();
118}
119
120// Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a
121// namespace.
124{
125 Q_ASSERT(t);
127 Scope scope(engine);
128
130 w->d()->mode = mode; w->d()->object = o; w->d()->typeNamespace = t.data(); w->d()->importNamespace = importNamespace;
131 t->addref();
132 return w.asReturnedValue();
133}
134
135static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, QObject *qobjectSingleton,
136 const QQmlType &type, bool *ok)
137{
138 Q_ASSERT(ok != nullptr);
139 int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, ok);
140 if (*ok)
141 return value;
142
143 // ### Optimize
144 QByteArray enumName = name->toQString().toUtf8();
145 const QMetaObject *metaObject = qobjectSingleton->metaObject();
146 for (int ii = metaObject->enumeratorCount() - 1; ii >= 0; --ii) {
147 QMetaEnum e = metaObject->enumerator(ii);
148 value = e.keyToValue(enumName.constData(), ok);
149 if (*ok)
150 return value;
151 }
152 *ok = false;
153 return -1;
154}
155
156ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
157{
158 // Keep this code in sync with ::virtualResolveLookupGetter
159 Q_ASSERT(m->as<QQmlTypeWrapper>());
160
161 if (!id.isString())
162 return Object::virtualGet(m, id, receiver, hasProperty);
163
164 QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine();
165 QV4::Scope scope(v4);
166 ScopedString name(scope, id.asStringOrSymbol());
167
168 Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m));
169
170 if (hasProperty)
171 *hasProperty = true;
172
174
175 QObject *object = w->d()->object;
176 QQmlType type = w->d()->type();
177
178 if (type.isValid()) {
179
180 // singleton types are handled differently to other types.
181 if (type.isSingleton()) {
183 QJSValue scriptSingleton;
184 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
185 if (QObject *qobjectSingleton = e->singletonInstance<QObject*>(type)) {
186 // check for enum value
187 const bool includeEnums = w->d()->mode == Heap::QQmlTypeWrapper::IncludeEnums;
188 if (includeEnums && name->startsWithUpper()) {
189 bool ok = false;
190 int value = enumForSingleton(v4, name, qobjectSingleton, type, &ok);
191 if (ok)
193
194 value = type.scopedEnumIndex(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok);
195 if (ok) {
197 enumWrapper->d()->typePrivate = type.priv();
198 QQmlType::refHandle(enumWrapper->d()->typePrivate);
199 enumWrapper->d()->scopeEnumIndex = value;
200 return enumWrapper.asReturnedValue();
201 }
202 }
203
204 // check for property.
205 bool ok;
207 v4, context, w->d(), qobjectSingleton, name,
209 if (hasProperty)
210 *hasProperty = ok;
211
212 return result;
213 }
214 } else if (type.isQJSValueSingleton()) {
215 QJSValue scriptSingleton = e->singletonInstance<QJSValue>(type);
216 if (!scriptSingleton.isUndefined()) {
217 // NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
218 QV4::ScopedObject o(scope, QJSValuePrivate::asReturnedValue(&scriptSingleton));
219 if (!!o)
220 return o->get(name);
221 }
222 }
223
224 // Fall through to base implementation
225
226 } else {
227
228 if (name->startsWithUpper()) {
229 bool ok = false;
230 int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok);
231 if (ok)
233
234 value = type.scopedEnumIndex(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok);
235 if (ok) {
237 enumWrapper->d()->typePrivate = type.priv();
238 QQmlType::refHandle(enumWrapper->d()->typePrivate);
239 enumWrapper->d()->scopeEnumIndex = value;
240 return enumWrapper.asReturnedValue();
241 }
242
243 // Fall through to base implementation
244
245 } else if (w->d()->object) {
247 object,
248 type.attachedPropertiesFunction(QQmlEnginePrivate::get(v4->qmlEngine())));
249 if (ao)
253
254 // Fall through to base implementation
255 }
256
257 // Fall through to base implementation
258 }
259
260 // Fall through to base implementation
261
262 } else if (w->d()->typeNamespace) {
263 Q_ASSERT(w->d()->importNamespace);
264 QQmlTypeNameCache::Result r = w->d()->typeNamespace->query(name, w->d()->importNamespace);
265
266 if (r.isValid()) {
267 if (r.type.isValid()) {
268 return create(scope.engine, object, r.type, w->d()->mode);
269 } else if (r.scriptIndex != -1) {
270 QV4::ScopedObject scripts(scope, context->importedScripts().valueRef());
271 return scripts->get(r.scriptIndex);
272 } else if (r.importNamespace) {
273 return create(scope.engine, object, context->imports(), r.importNamespace);
274 }
275
276 return QV4::Encode::undefined();
277
278 }
279
280 // Fall through to base implementation
281
282 } else {
283 Q_ASSERT(!"Unreachable");
284 }
285
286 bool ok = false;
287 const ReturnedValue result = Object::virtualGet(m, id, receiver, &ok);
288 if (hasProperty)
289 *hasProperty = ok;
290
291 return result;
292}
293
294
296{
297 if (!id.isString())
298 return Object::virtualPut(m, id, value, receiver);
299
300
301 Q_ASSERT(m->as<QQmlTypeWrapper>());
302 QQmlTypeWrapper *w = static_cast<QQmlTypeWrapper *>(m);
303 QV4::Scope scope(w);
304 if (scope.hasException())
305 return false;
306
307 ScopedString name(scope, id.asStringOrSymbol());
309
310 QQmlType type = w->d()->type();
311 if (type.isValid() && !type.isSingleton() && w->d()->object) {
312 QObject *object = w->d()->object;
313 QQmlEngine *e = scope.engine->qmlEngine();
315 object, type.attachedPropertiesFunction(QQmlEnginePrivate::get(e)));
316 if (ao)
319 return false;
320 } else if (type.isSingleton()) {
322 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
323 if (QObject *qobjectSingleton = e->singletonInstance<QObject*>(type))
325 scope.engine, context, qobjectSingleton, name,
327
328 } else {
329 QJSValue scriptSingleton = e->singletonInstance<QJSValue>(type);
330 if (!scriptSingleton.isUndefined()) {
331 QV4::ScopedObject apiprivate(scope, QJSValuePrivate::asReturnedValue(&scriptSingleton));
332 if (!apiprivate) {
333 QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
334 scope.engine->throwError(error);
335 return false;
336 } else {
337 return apiprivate->put(name, value);
338 }
339 }
340 }
341 }
342
343 return false;
344}
345
347{
348 if (id.isString()) {
349 Scope scope(m);
350 ScopedString n(scope, id.asStringOrSymbol());
351 // ### Implement more efficiently.
352 bool hasProperty = false;
353 static_cast<const Object *>(m)->get(n, &hasProperty);
355 }
356
358}
359
361{
363 QV4::QQmlTypeWrapper *qmlTypeWrapperA = static_cast<QV4::QQmlTypeWrapper *>(a);
364 if (QV4::QQmlTypeWrapper *qmlTypeWrapperB = b->as<QV4::QQmlTypeWrapper>())
365 return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant();
366 else if (QV4::QObjectWrapper *qobjectWrapper = b->as<QV4::QObjectWrapper>())
367 return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object();
368
369 return false;
370}
371
372static ReturnedValue instanceOfQObject(const QV4::QQmlTypeWrapper *typeWrapper, const QObjectWrapper *objectWrapper)
373{
375 // in case the wrapper outlived the QObject*
376 const QObject *wrapperObject = objectWrapper->object();
377 if (!wrapperObject)
378 return engine->throwTypeError();
379
380 const QMetaType myTypeId = typeWrapper->d()->type().typeId();
381 QQmlMetaObject myQmlType;
382 if (!myTypeId.isValid()) {
383 // we're a composite type; a composite type cannot be equal to a
384 // non-composite object instance (Rectangle{} is never an instance of
385 // CustomRectangle)
386 QQmlData *theirDData = QQmlData::get(wrapperObject);
387 Q_ASSERT(theirDData); // must exist, otherwise how do we have a QObjectWrapper for it?!
388 if (!theirDData->compilationUnit)
389 return Encode(false);
390
391 QQmlEnginePrivate *qenginepriv = QQmlEnginePrivate::get(engine->qmlEngine());
392 QQmlRefPointer<QQmlTypeData> td = qenginepriv->typeLoader.getType(typeWrapper->d()->type().sourceUrl());
393 if (ExecutableCompilationUnit *cu = td->compilationUnit())
394 myQmlType = QQmlMetaType::metaObjectForType(cu->qmlType.typeId());
395 else
396 return Encode(false); // It seems myQmlType has some errors, so we could not compile it.
397 } else {
398 myQmlType = QQmlMetaType::metaObjectForType(myTypeId);
399 if (myQmlType.isNull())
400 return Encode(false);
401 }
402
403 const QMetaObject *theirType = wrapperObject->metaObject();
404
405 return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType));
406}
407
409{
410 Q_ASSERT(typeObject->as<QV4::QQmlTypeWrapper>());
411 const QV4::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::QQmlTypeWrapper *>(typeObject);
412
413 if (const QObjectWrapper *objectWrapper = var.as<QObjectWrapper>())
414 return instanceOfQObject(typeWrapper, objectWrapper);
415
416 if (const QMetaObject *valueTypeMetaObject
417 = QQmlMetaType::metaObjectForValueType(typeWrapper->d()->type())) {
418 if (const QQmlValueTypeWrapper *valueWrapper = var.as<QQmlValueTypeWrapper>()) {
419 return QV4::Encode(QQmlMetaObject::canConvert(valueWrapper->metaObject(),
420 valueTypeMetaObject));
421 }
422
423 // We want "foo as valuetype" to return undefined if it doesn't match.
424 return Encode::undefined();
425 }
426
427 // If the target type is an object type we want null.
428 return Encode(false);
429}
430
432{
433 // Keep this code in sync with ::virtualGet
435 if (!id.isString())
436 return Object::virtualResolveLookupGetter(object, engine, lookup);
437 Scope scope(engine);
438
439 const QQmlTypeWrapper *This = static_cast<const QQmlTypeWrapper *>(object);
440 ScopedString name(scope, id.asStringOrSymbol());
442
443 Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(This));
444 QQmlType type = w->d()->type();
445
446 if (type.isValid()) {
447
448 if (type.isSingleton()) {
450 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
451 if (QObject *qobjectSingleton = e->singletonInstance<QObject*>(type)) {
452 const bool includeEnums = w->d()->mode == Heap::QQmlTypeWrapper::IncludeEnums;
453 if (!includeEnums || !name->startsWithUpper()) {
454 QQmlData *ddata = QQmlData::get(qobjectSingleton, false);
455 if (ddata && ddata->propertyCache) {
456 const QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobjectSingleton, qmlContext);
457 if (property) {
461 lookup, ddata, property, val->objectValue(), nullptr);
463 } else {
465 lookup, ddata, property, val->objectValue(), This);
467 }
468 return lookup->getter(lookup, engine, *object);
469 }
470 // Fall through to base implementation
471 }
472 // Fall through to base implementation
473 }
474 // Fall through to base implementation
475 }
476 // Fall through to base implementation
477 }
478 // Fall through to base implementation
479 }
480
481 if (name->startsWithUpper()) {
482 bool ok = false;
483 int value = type.enumValue(QQmlEnginePrivate::get(engine->qmlEngine()), name, &ok);
484 if (ok) {
485 lookup->qmlEnumValueLookup.ic = This->internalClass();
489 return lookup->getter(lookup, engine, *object);
490 }
491
492 value = type.scopedEnumIndex(QQmlEnginePrivate::get(engine->qmlEngine()), name, &ok);
493 if (ok) {
496 enumWrapper->d()->typePrivate = type.priv();
497 QQmlType::refHandle(enumWrapper->d()->typePrivate);
498 enumWrapper->d()->scopeEnumIndex = value;
499
502 = static_cast<Heap::Object*>(enumWrapper->heapObject());
504 return enumWrapper.asReturnedValue();
505 }
506 // Fall through to base implementation
507 }
508 // Fall through to base implementation
509 }
510 return QV4::Object::virtualResolveLookupGetter(object, engine, lookup);
511}
512
514{
515 return Object::virtualResolveLookupSetter(object, engine, lookup, value);
516}
517
519{
520 QV4::Scope scope(m->engine());
521 QV4::Scoped<QQmlTypeWrapper> typeWrapper(scope, m);
522 Q_ASSERT(typeWrapper);
523 if (QObject *object = typeWrapper->object()) {
524 QV4::Scoped<QV4::QObjectWrapper> objectWrapper(scope, QV4::QObjectWrapper::wrap(typeWrapper->engine(), object));
526 }
527
529}
530
532{
533 QQmlTypeWrapper *wrapper = object->as<QQmlTypeWrapper>();
535
536 if (QObject *qObject = wrapper->object())
537 return QMetaObject::metacall(qObject, call, index, a);
538
539 return 0;
540}
541
543{
544 const auto revertLookup = [l, engine, &object]() {
546 l->qobjectLookup.propertyCache = nullptr;
548 return Lookup::getterGeneric(l, engine, object);
549 };
550
551 // we can safely cast to a QV4::Object here. If object is something else,
552 // the internal class won't match
553 Heap::Object *o = static_cast<Heap::Object *>(object.heapObject());
554
555 // The qmlTypeIc check is not strictly necessary.
556 // If we have different ways to get to the same QObject type
557 // we can use the same lookup to get its properties, no matter
558 // how we've found the object. Most of the few times this check
559 // fails, we will, of course have different object types. So
560 // this check provides an early exit for the error case.
561 //
562 // So, if we ever need more bits in qobjectLookup, qmlTypeIc is the
563 // member to be replaced.
564 if (!o || o->internalClass != l->qobjectLookup.qmlTypeIc)
565 return revertLookup();
566
567 Heap::QQmlTypeWrapper *This = static_cast<Heap::QQmlTypeWrapper *>(o);
568
569 QQmlType type = This->type();
570 if (!type.isValid())
571 return revertLookup();
572
573 if (!type.isQObjectSingleton() && !type.isCompositeSingleton())
574 return revertLookup();
575
577 QObject *qobjectSingleton = e->singletonInstance<QObject *>(type);
578 Q_ASSERT(qobjectSingleton);
579
580 Scope scope(engine);
581 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, qobjectSingleton));
582 const QObjectWrapper::Flags flags = l->forCall
585 return QObjectWrapper::lookupPropertyGetterImpl(l, engine, obj, flags, revertLookup);
586}
587
589{
590 const auto revertLookup = [l, engine, &object]() {
594 return Lookup::getterGeneric(l, engine, object);
595 };
596
597 // We cannot safely cast here as we don't explicitly check the IC. Therefore as().
598 const QQmlTypeWrapper *This = object.as<QQmlTypeWrapper>();
599 if (!This)
600 return revertLookup();
601
602 QQmlType type = This->d()->type();
603 if (!type.isValid())
604 return revertLookup();
605
606 if (!type.isQObjectSingleton() && !type.isCompositeSingleton())
607 return revertLookup();
608
610 QObject *qobjectSingleton = e->singletonInstance<QObject *>(type);
611 Q_ASSERT(qobjectSingleton);
612
613 Scope scope(engine);
614 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, qobjectSingleton));
617 revertLookup);
618}
619
621{
622 auto *o = static_cast<Heap::Object *>(base.heapObject());
623 if (!o || o->internalClass != l->qmlEnumValueLookup.ic) {
626 }
627
629}
630
632{
633 Scope scope(engine);
634 Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, static_cast<Heap::QQmlScopedEnumWrapper *>(
636
637 auto *o = static_cast<Heap::Object *>(base.heapObject());
638 if (!o || o->internalClass != l->qmlScopedEnumWrapperLookup.ic) {
639 QQmlType::derefHandle(enumWrapper->d()->typePrivate);
643 }
644
645 return enumWrapper.asReturnedValue();
646}
647
649{
650 QQmlType::derefHandle(typePrivate);
651 typePrivate = nullptr;
652 Object::destroy();
653}
654
656{
657 return QQmlType(typePrivate);
658}
659
660ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
661{
663 if (!id.isString())
664 return Object::virtualGet(m, id, receiver, hasProperty);
665
666 const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m);
667 QV4::ExecutionEngine *v4 = resource->engine();
668 QV4::Scope scope(v4);
669 ScopedString name(scope, id.asStringOrSymbol());
670
671 QQmlType type = resource->d()->type();
672 int index = resource->d()->scopeEnumIndex;
673
674 bool ok = false;
675 int value = type.scopedEnumValue(QQmlEnginePrivate::get(v4->qmlEngine()), index, name, &ok);
676 if (hasProperty)
677 *hasProperty = ok;
678 if (ok)
680
681 return Encode::undefined();
682}
683
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:122
static QV4::ReturnedValue asReturnedValue(const QJSValue *jsval)
Definition qjsvalue_p.h:249
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
bool isUndefined() const
Returns true if this QJSValue is of the primitive type Undefined or if the managed value has been cle...
Definition qjsvalue.cpp:349
\inmodule QtCore
\inmodule QtCore
Definition qmetatype.h:320
bool isValid() const
\inmodule QtCore
Definition qobject.h:90
QQmlRefPointer< QV4::ExecutableCompilationUnit > compilationUnit
Definition qqmldata_p.h:186
QQmlPropertyCache::ConstPtr propertyCache
Definition qqmldata_p.h:195
static QQmlData * get(QObjectPrivate *priv, bool create)
Definition qqmldata_p.h:199
QQmlTypeLoader typeLoader
static QQmlEnginePrivate * get(QQmlEngine *e)
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
T singletonInstance(int qmlTypeId)
\qmlproperty string Qt::uiLanguage
Definition qqmlengine.h:164
bool isNull() const
static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to)
static const QMetaObject * metaObjectForValueType(QMetaType type)
static QQmlMetaObject metaObjectForType(QMetaType metaType)
void release() const
QQmlRefPointer< QQmlTypeData > getType(const QUrl &unNormalizedUrl, Mode mode=PreferSynchronous)
Returns a QQmlTypeData for the specified url.
static void refHandle(const QQmlTypePrivate *priv)
Definition qqmltype.cpp:894
static void derefHandle(const QQmlTypePrivate *priv)
Definition qqmltype.cpp:900
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
ObjectType::Data * allocate(Args &&... args)
Definition qv4mm_p.h:199
\inmodule QtCore
Definition qvariant.h:64
T value() const &
Definition qvariant.h:511
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:531
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)
@ Attr_Invalid
@ Attr_Data
bool qualifiesForMethodLookup(const QQmlPropertyData *propertyData)
static void * context
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLenum mode
const GLfloat * m
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint index
[2]
GLboolean r
[2]
GLenum type
GLenum target
GLbitfield flags
GLuint name
GLfloat n
GLhandleARB obj
[2]
GLuint GLfloat * val
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
QQmlEngine * qmlEngine(const QObject *obj)
Definition qqml.cpp:76
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:71
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool create)
Definition qqml.cpp:110
static ReturnedValue instanceOfQObject(const QV4::QQmlTypeWrapper *typeWrapper, const QObjectWrapper *objectWrapper)
static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, QObject *qobjectSingleton, const QQmlType &type, bool *ok)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define DEFINE_OBJECT_VTABLE(classname)
const char property[13]
Definition qwizard.cpp:101
obj metaObject() -> className()
view create()
QJSEngine engine
[0]
\inmodule QtCore \reentrant
Definition qchar.h:17
\inmodule QtCore
static int metacall(QObject *, Call, int, void **)
static constexpr ReturnedValue undefined()
IdentifierTable * identifierTable
MemoryManager * memoryManager
CppStackFrame * currentStackFrame
QQmlRefPointer< QQmlContextData > callingQmlContext() const
ReturnedValue throwError(const Value &value)
QQmlEngine * qmlEngine() const
CompiledData::CompilationUnitBase * compilationUnit
const QQmlImportRef * importNamespace
QV4QPointer< QObject > object
PropertyKey asPropertyKey(const Heap::String *str)
struct QV4::Lookup::@576::@611 qmlEnumValueLookup
struct QV4::Lookup::@576::@601 qobjectLookup
ReturnedValue encodedEnumValue
ReturnedValue(* getter)(Lookup *l, ExecutionEngine *engine, const Value &object)
Definition qv4lookup_p.h:36
static ReturnedValue getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object)
Heap::InternalClass * qmlTypeIc
Definition qv4lookup_p.h:94
Heap::InternalClass * ic
Definition qv4lookup_p.h:51
struct QV4::Lookup::@576::@602 qobjectMethodLookup
const QQmlPropertyCache * propertyCache
Definition qv4lookup_p.h:95
Heap::Object * qmlScopedEnumWrapper
struct QV4::Lookup::@576::@612 qmlScopedEnumWrapperLookup
Heap::InternalClass * internalClass() const
ExecutionEngine * engine() 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)
QObject * object() const
static ReturnedValue lookupMethodGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue lookupScopedEnum(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue lookupSingletonMethod(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlType &, Heap::QQmlTypeWrapper::TypeNameMode=Heap::QQmlTypeWrapper::IncludeEnums)
V4_NEEDS_DESTROY bool isSingleton() const
QObject * singletonObject() const
const QMetaObject * metaObject() const
QVariant toVariant() const
static ReturnedValue lookupEnumValue(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue lookupSingletonProperty(Lookup *l, ExecutionEngine *engine, const Value &base)
bool hasException() const
ExecutionEngine * engine
QML_NEARLY_ALWAYS_INLINE ReturnedValue asReturnedValue() const
constexpr ReturnedValue asReturnedValue() const
QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys
static constexpr VTable::GetOwnProperty virtualGetOwnProperty
static constexpr VTable::Get virtualGet
static constexpr VTable::Metacall virtualMetacall
static constexpr VTable::InstanceOf virtualInstanceOf
static constexpr VTable::Put virtualPut
static constexpr VTable::IsEqualTo virtualIsEqualTo
static constexpr VTable::ResolveLookupGetter virtualResolveLookupGetter
static constexpr VTable::ResolveLookupSetter virtualResolveLookupSetter
static constexpr Value fromInt32(int i)
Definition qv4value_p.h:187
bool isString() const
Definition qv4value_p.h:284
static constexpr Value fromReturnedValue(ReturnedValue val)
Definition qv4value_p.h:165
const T * as() const
Definition qv4value_p.h:132
void wrapper()