Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
26
28{
30 Object::init();
31 flags = quint8(m) | quint8(Type);
32 object.init(o);
34 t.typePrivate = type;
35}
36
39{
41 Object::init();
42 flags = quint8(m) | quint8(Namespace);
43 object.init(o);
44 n.typeNamespace = type;
45 n.typeNamespace->addref();
46 n.importNamespace = import;
47}
48
50{
51 switch (kind()) {
52 case Type:
53 Q_ASSERT(t.typePrivate);
54 QQmlType::derefHandle(t.typePrivate);
55 break;
56 case Namespace:
57 Q_ASSERT(n.typeNamespace);
58 n.typeNamespace->release();
59 break;
60 }
61
62 object.destroy();
63 Object::destroy();
64}
65
67{
68 switch (kind()) {
69 case Type:
70 return QQmlType(t.typePrivate);
71 case Namespace:
72 return QQmlType();
73 }
74
75 Q_UNREACHABLE_RETURN(QQmlType());
76}
77
79 const QV4::String *name, QQmlEnginePrivate *enginePrivate) const
80{
81 Q_ASSERT(kind() == Namespace);
82 Q_ASSERT(n.typeNamespace);
83 Q_ASSERT(n.importNamespace);
84 return n.typeNamespace->query(name, n.importNamespace, QQmlTypeLoader::get(enginePrivate));
85
86}
87
89{
90 return d()->type().isSingleton();
91}
92
94{
95 const QQmlType type = d()->type();
96 if (!type.isValid())
97 return nullptr;
98
99 if (type.isSingleton()) {
100 auto metaObjectCandidate = type.metaObject();
101 // if the candidate is the same as te baseMetaObject, we know that
102 // we don't have an extended singleton; in that case the
103 // actual instance might be subclass of type instead of type itself
104 // so we need to query the actual object for it's meta-object
105 if (metaObjectCandidate == type.baseMetaObject()) {
107 auto object = qmlEngine->singletonInstance<QObject *>(type);
108 if (object)
109 return object->metaObject();
110 }
111 /* if we instead have an extended singleton, the dynamic proxy
112 meta-object must alreday be set up correctly
113 ### TODO: it isn't, as QQmlTypePrivate::init has no way to
114 query the object
115 */
116 return metaObjectCandidate;
117 }
118
119 return type.attachedPropertiesType(QQmlEnginePrivate::get(engine()->qmlEngine()));
120}
121
123{
124 const QQmlType type = d()->type();
125 if (!type.isValid())
126 return nullptr;
127
129 if (type.isSingleton())
131
133 d()->object,
134 type.attachedPropertiesFunction(qmlEngine));
135}
136
138{
139 if (!isSingleton())
140 return nullptr;
141
143 return e->singletonInstance<QObject*>(d()->type());
144}
145
147{
149 const QQmlType type = d()->type();
150
151 if (!isSingleton()) {
153 d()->object, type.attachedPropertiesFunction(e)));
154 }
155
156 if (type.isQJSValueSingleton())
157 return QVariant::fromValue<QJSValue>(e->singletonInstance<QJSValue>(type));
158
159 return QVariant::fromValue<QObject*>(e->singletonInstance<QObject*>(type));
160}
161
162
163// Returns a type wrapper for type t on o. This allows access of enums, and attached properties.
166{
167 Q_ASSERT(t.isValid());
168 Scope scope(engine);
169
170 Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>(
171 mode, o, t.priv()));
172 return w.asReturnedValue();
173}
174
175// Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a
176// namespace.
178 QV4::ExecutionEngine *engine, QObject *o, const QQmlRefPointer<QQmlTypeNameCache> &t,
180{
181 Q_ASSERT(t);
183 Scope scope(engine);
184
185 Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>(
186 mode, o, t.data(), importNamespace));
187 return w.asReturnedValue();
188}
189
191{
192 Q_ASSERT(ok != nullptr);
193 const int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, ok);
194 return *ok ? value : -1;
195}
196
197ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
198{
199 // Keep this code in sync with ::virtualResolveLookupGetter
200 Q_ASSERT(m->as<QQmlTypeWrapper>());
201
202 if (!id.isString())
203 return Object::virtualGet(m, id, receiver, hasProperty);
204
205 QV4::ExecutionEngine *v4 = m->engine();
206 QV4::Scope scope(v4);
207 ScopedString name(scope, id.asStringOrSymbol());
208
209 Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m));
210
211 if (hasProperty)
212 *hasProperty = true;
213
214 QQmlRefPointer<QQmlContextData> context = v4->callingQmlContext();
215
216 QObject *object = w->d()->object;
217 QQmlType type = w->d()->type();
218
219 QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(v4->qmlEngine());
220 if (type.isValid()) {
221
222 // singleton types are handled differently to other types.
223 if (type.isSingleton()) {
224
225 QJSValue scriptSingleton;
226 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
227 if (QObject *qobjectSingleton = enginePrivate->singletonInstance<QObject*>(type)) {
228 // check for enum value
229 const bool includeEnums
230 = w->d()->typeNameMode() == Heap::QQmlTypeWrapper::IncludeEnums;
231 if (includeEnums && name->startsWithUpper()) {
232 bool ok = false;
233 int value = enumForSingleton(v4, name, type, &ok);
234 if (ok)
235 return QV4::Value::fromInt32(value).asReturnedValue();
236
237 value = type.scopedEnumIndex(enginePrivate, name, &ok);
238 if (ok) {
239 Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, v4->memoryManager->allocate<QQmlScopedEnumWrapper>());
240 enumWrapper->d()->typePrivate = type.priv();
241 QQmlType::refHandle(enumWrapper->d()->typePrivate);
242 enumWrapper->d()->scopeEnumIndex = value;
243 return enumWrapper.asReturnedValue();
244 }
245 }
246
247 // check for property.
248 bool ok;
250 v4, context, w->d(), qobjectSingleton, name,
252 if (hasProperty)
253 *hasProperty = ok;
254
255 return result;
256 }
257 } else if (type.isQJSValueSingleton()) {
258 QJSValue scriptSingleton = enginePrivate->singletonInstance<QJSValue>(type);
259 if (!scriptSingleton.isUndefined()) {
260 // NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
261 QV4::ScopedObject o(scope, QJSValuePrivate::asReturnedValue(&scriptSingleton));
262 if (!!o)
263 return o->get(name);
264 }
265 }
266
267 // Fall through to base implementation
268
269 } else {
270
271 if (name->startsWithUpper()) {
272 bool ok = false;
273 int value = type.enumValue(enginePrivate, name, &ok);
274 if (ok)
275 return QV4::Value::fromInt32(value).asReturnedValue();
276
277 value = type.scopedEnumIndex(enginePrivate, name, &ok);
278 if (ok) {
279 Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, v4->memoryManager->allocate<QQmlScopedEnumWrapper>());
280 enumWrapper->d()->typePrivate = type.priv();
281 QQmlType::refHandle(enumWrapper->d()->typePrivate);
282 enumWrapper->d()->scopeEnumIndex = value;
283 return enumWrapper.asReturnedValue();
284 }
285
286 // Fall through to base implementation
287
288 } else if (w->d()->object) {
290 object,
291 type.attachedPropertiesFunction(QQmlEnginePrivate::get(v4->qmlEngine())));
292 if (ao)
296
297 // Fall through to base implementation
298 }
299
300 // Fall through to base implementation
301 }
302
303 // Fall through to base implementation
304
305 } else if (w->d()->kind() == Heap::QQmlTypeWrapper::Namespace) {
306 const QQmlTypeNameCache::Result r = w->d()->queryNamespace(name, enginePrivate);
307 if (r.isValid()) {
308 if (r.type.isValid()) {
309 return create(scope.engine, object, r.type, w->d()->typeNameMode());
310 } else if (r.scriptIndex != -1) {
311 QV4::ScopedObject scripts(scope, context->importedScripts().valueRef());
312 return scripts->get(r.scriptIndex);
313 } else if (r.importNamespace) {
314 return create(scope.engine, object, context->imports(), r.importNamespace);
315 }
316
317 return QV4::Encode::undefined();
318
319 }
320
321 // Fall through to base implementation
322
323 } else {
324 Q_ASSERT(!"Unreachable");
325 }
326
327 bool ok = false;
328 const ReturnedValue result = Object::virtualGet(m, id, receiver, &ok);
329 if (hasProperty)
330 *hasProperty = ok;
331
332 return result;
333}
334
335
337{
338 if (!id.isString())
339 return Object::virtualPut(m, id, value, receiver);
340
341
342 Q_ASSERT(m->as<QQmlTypeWrapper>());
343 QQmlTypeWrapper *w = static_cast<QQmlTypeWrapper *>(m);
344 QV4::Scope scope(w);
345 if (scope.hasException())
346 return false;
347
348 ScopedString name(scope, id.asStringOrSymbol());
349 QQmlRefPointer<QQmlContextData> context = scope.engine->callingQmlContext();
350
351 QQmlType type = w->d()->type();
352 if (type.isValid() && !type.isSingleton() && w->d()->object) {
353 QObject *object = w->d()->object;
354 QQmlEngine *e = scope.engine->qmlEngine();
356 object, type.attachedPropertiesFunction(QQmlEnginePrivate::get(e)));
357 if (ao)
360 return false;
361 } else if (type.isSingleton()) {
363 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
364 if (QObject *qobjectSingleton = e->singletonInstance<QObject*>(type))
366 scope.engine, context, qobjectSingleton, name,
368
369 } else {
370 QJSValue scriptSingleton = e->singletonInstance<QJSValue>(type);
371 if (!scriptSingleton.isUndefined()) {
372 QV4::ScopedObject apiprivate(scope, QJSValuePrivate::asReturnedValue(&scriptSingleton));
373 if (!apiprivate) {
374 QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
375 scope.engine->throwError(error);
376 return false;
377 } else {
378 return apiprivate->put(name, value);
379 }
380 }
381 }
382 }
383
384 return false;
385}
386
388{
389 if (id.isString()) {
390 Scope scope(m);
391 ScopedString n(scope, id.asStringOrSymbol());
392 // ### Implement more efficiently.
393 bool hasProperty = false;
394 static_cast<const Object *>(m)->get(n, &hasProperty);
396 }
397
399}
400
402{
404 QV4::QQmlTypeWrapper *qmlTypeWrapperA = static_cast<QV4::QQmlTypeWrapper *>(a);
405 if (QV4::QQmlTypeWrapper *qmlTypeWrapperB = b->as<QV4::QQmlTypeWrapper>())
406 return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant();
407 else if (QV4::QObjectWrapper *qobjectWrapper = b->as<QV4::QObjectWrapper>())
408 return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object();
409
410 return false;
411}
412
413static ReturnedValue instanceOfQObject(const QV4::QQmlTypeWrapper *typeWrapper, const QObjectWrapper *objectWrapper)
414{
415 QV4::ExecutionEngine *engine = typeWrapper->internalClass()->engine;
416 // in case the wrapper outlived the QObject*
417 const QObject *wrapperObject = objectWrapper->object();
418 if (!wrapperObject)
419 return engine->throwTypeError();
420
421 const QMetaType myTypeId = typeWrapper->d()->type().typeId();
422 QQmlMetaObject myQmlType;
423 if (!myTypeId.isValid()) {
424 // we're a composite type; a composite type cannot be equal to a
425 // non-composite object instance (Rectangle{} is never an instance of
426 // CustomRectangle)
427 QQmlData *theirDData = QQmlData::get(wrapperObject);
428 Q_ASSERT(theirDData); // must exist, otherwise how do we have a QObjectWrapper for it?!
429 if (!theirDData->compilationUnit)
430 return Encode(false);
431
432 QQmlEnginePrivate *qenginepriv = QQmlEnginePrivate::get(engine->qmlEngine());
433 QQmlRefPointer<QQmlTypeData> td = qenginepriv->typeLoader.getType(typeWrapper->d()->type().sourceUrl());
434 if (CompiledData::CompilationUnit *cu = td->compilationUnit())
435 myQmlType = QQmlMetaType::metaObjectForType(cu->metaType());
436 else
437 return Encode(false); // It seems myQmlType has some errors, so we could not compile it.
438 } else {
439 myQmlType = QQmlMetaType::metaObjectForType(myTypeId);
440 if (myQmlType.isNull())
441 return Encode(false);
442 }
443
444 const QMetaObject *theirType = wrapperObject->metaObject();
445
446 return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType));
447}
448
450{
451 Q_ASSERT(typeObject->as<QV4::QQmlTypeWrapper>());
452 const QV4::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::QQmlTypeWrapper *>(typeObject);
453
454 if (const QObjectWrapper *objectWrapper = var.as<QObjectWrapper>())
455 return instanceOfQObject(typeWrapper, objectWrapper);
456
457 const QQmlType type = typeWrapper->d()->type();
458 if (type.isValueType()) {
459 if (const QQmlValueTypeWrapper *valueWrapper = var.as<QQmlValueTypeWrapper>()) {
460 return QV4::Encode(QQmlMetaObject::canConvert(valueWrapper->metaObject(),
461 type.metaObjectForValueType()));
462 }
463
464 // We want "foo as valuetype" to return undefined if it doesn't match.
465 return Encode::undefined();
466 }
467
468 // If the target type is an object type we want null.
469 return Encode(false);
470}
471
473{
474 // Keep this code in sync with ::virtualGet
476 if (!id.isString())
477 return Object::virtualResolveLookupGetter(object, engine, lookup);
478 Scope scope(engine);
479
480 const QQmlTypeWrapper *This = static_cast<const QQmlTypeWrapper *>(object);
481 ScopedString name(scope, id.asStringOrSymbol());
482 QQmlRefPointer<QQmlContextData> qmlContext = engine->callingQmlContext();
483
484 Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(This));
485 QQmlType type = w->d()->type();
486
487 if (type.isValid()) {
488
489 if (type.isSingleton()) {
491 if (type.isQObjectSingleton() || type.isCompositeSingleton()) {
492 if (QObject *qobjectSingleton = e->singletonInstance<QObject*>(type)) {
493 const bool includeEnums
494 = w->d()->typeNameMode() == Heap::QQmlTypeWrapper::IncludeEnums;
495 if (!includeEnums || !name->startsWithUpper()) {
496 QQmlData *ddata = QQmlData::get(qobjectSingleton, false);
497 if (ddata && ddata->propertyCache) {
498 const QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobjectSingleton, qmlContext);
499 if (property) {
502 QV4::Heap::QObjectMethod *method = nullptr;
504 lookup, ddata, property, val->objectValue(), method);
506 } else {
508 lookup, ddata, property, val->objectValue(), This);
510 }
511 return lookup->getter(lookup, engine, *object);
512 }
513 // Fall through to base implementation
514 }
515 // Fall through to base implementation
516 }
517 // Fall through to base implementation
518 }
519 // Fall through to base implementation
520 }
521 // Fall through to base implementation
522 }
523
524 if (name->startsWithUpper()) {
525 bool ok = false;
526 int value = type.enumValue(QQmlEnginePrivate::get(engine->qmlEngine()), name, &ok);
527 if (ok) {
528 lookup->qmlEnumValueLookup.ic.set(engine, This->internalClass());
529 lookup->qmlEnumValueLookup.encodedEnumValue
530 = QV4::Value::fromInt32(value).asReturnedValue();
532 return lookup->getter(lookup, engine, *object);
533 }
534
535 value = type.scopedEnumIndex(QQmlEnginePrivate::get(engine->qmlEngine()), name, &ok);
536 if (ok) {
537 Scoped<QQmlScopedEnumWrapper> enumWrapper(
539 enumWrapper->d()->typePrivate = type.priv();
540 QQmlType::refHandle(enumWrapper->d()->typePrivate);
541 enumWrapper->d()->scopeEnumIndex = value;
542
543 lookup->qmlScopedEnumWrapperLookup.ic.set(engine, This->internalClass());
544 lookup->qmlScopedEnumWrapperLookup.qmlScopedEnumWrapper.set(engine,
545 static_cast<Heap::Object*>(enumWrapper->heapObject()));
547 return enumWrapper.asReturnedValue();
548 }
549 // Fall through to base implementation
550 }
551 // Fall through to base implementation
552 }
553 return QV4::Object::virtualResolveLookupGetter(object, engine, lookup);
554}
555
560
562{
563 QV4::Scope scope(m->engine());
564 QV4::Scoped<QQmlTypeWrapper> typeWrapper(scope, m);
565 Q_ASSERT(typeWrapper);
566 if (QObject *object = typeWrapper->object()) {
567 QV4::Scoped<QV4::QObjectWrapper> objectWrapper(scope, QV4::QObjectWrapper::wrap(typeWrapper->engine(), object));
569 }
570
572}
573
575{
578
579 if (QObject *qObject = wrapper->object())
580 return QMetaObject::metacall(qObject, call, index, a);
581
582 return 0;
583}
584
586{
587 const auto revertLookup = [l, engine, &object]() {
588 l->qobjectLookup.propertyCache->release();
589 l->qobjectLookup.propertyCache = nullptr;
591 return Lookup::getterGeneric(l, engine, object);
592 };
593
594 // we can safely cast to a QV4::Object here. If object is something else,
595 // the internal class won't match
596 Heap::Object *o = static_cast<Heap::Object *>(object.heapObject());
597
598 // The qmlTypeIc check is not strictly necessary.
599 // If we have different ways to get to the same QObject type
600 // we can use the same lookup to get its properties, no matter
601 // how we've found the object. Most of the few times this check
602 // fails, we will, of course have different object types. So
603 // this check provides an early exit for the error case.
604 //
605 // So, if we ever need more bits in qobjectLookup, qmlTypeIc is the
606 // member to be replaced.
607 if (!o || o->internalClass != l->qobjectLookup.qmlTypeIc)
608 return revertLookup();
609
610 Heap::QQmlTypeWrapper *This = static_cast<Heap::QQmlTypeWrapper *>(o);
611
612 QQmlType type = This->type();
613 if (!type.isValid())
614 return revertLookup();
615
616 if (!type.isQObjectSingleton() && !type.isCompositeSingleton())
617 return revertLookup();
618
620 QObject *qobjectSingleton = e->singletonInstance<QObject *>(type);
621 Q_ASSERT(qobjectSingleton);
622
623 Scope scope(engine);
624 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, qobjectSingleton));
625 const QObjectWrapper::Flags flags = l->forCall
628 return QObjectWrapper::lookupPropertyGetterImpl(l, engine, obj, flags, revertLookup);
629}
630
632{
633 const auto revertLookup = [l, engine, &object]() {
634 l->qobjectMethodLookup.propertyCache->release();
635 l->qobjectMethodLookup.propertyCache = nullptr;
637 return Lookup::getterGeneric(l, engine, object);
638 };
639
640 // We cannot safely cast here as we don't explicitly check the IC. Therefore as().
641 const QQmlTypeWrapper *This = object.as<QQmlTypeWrapper>();
642 if (!This)
643 return revertLookup();
644
645 QQmlType type = This->d()->type();
646 if (!type.isValid())
647 return revertLookup();
648
649 if (!type.isQObjectSingleton() && !type.isCompositeSingleton())
650 return revertLookup();
651
653 QObject *qobjectSingleton = e->singletonInstance<QObject *>(type);
654 Q_ASSERT(qobjectSingleton);
655
656 Scope scope(engine);
657 ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, qobjectSingleton));
660 revertLookup);
661}
662
664{
665 auto *o = static_cast<Heap::Object *>(base.heapObject());
666 if (!o || o->internalClass != l->qmlEnumValueLookup.ic) {
669 }
670
671 return l->qmlEnumValueLookup.encodedEnumValue;
672}
673
675{
676 Scope scope(engine);
677 Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, static_cast<Heap::QQmlScopedEnumWrapper *>(
678 l->qmlScopedEnumWrapperLookup.qmlScopedEnumWrapper.get()));
679
680 auto *o = static_cast<Heap::Object *>(base.heapObject());
681 if (!o || o->internalClass != l->qmlScopedEnumWrapperLookup.ic) {
682 QQmlType::derefHandle(enumWrapper->d()->typePrivate);
683 l->qmlScopedEnumWrapperLookup.qmlScopedEnumWrapper.clear();
686 }
687
688 return enumWrapper.asReturnedValue();
689}
690
692{
693 QQmlType::derefHandle(typePrivate);
694 typePrivate = nullptr;
695 Object::destroy();
696}
697
699{
700 return QQmlType(typePrivate);
701}
702
703ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
704{
706 if (!id.isString())
707 return Object::virtualGet(m, id, receiver, hasProperty);
708
709 const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m);
710 QV4::ExecutionEngine *v4 = resource->engine();
711 QV4::Scope scope(v4);
712 ScopedString name(scope, id.asStringOrSymbol());
713
714 QQmlType type = resource->d()->type();
715 int index = resource->d()->scopeEnumIndex;
716
717 bool ok = false;
718 int value = type.scopedEnumValue(QQmlEnginePrivate::get(v4->qmlEngine()), index, name, &ok);
719 if (hasProperty)
720 *hasProperty = ok;
721 if (ok)
722 return QV4::Value::fromInt32(value).asReturnedValue();
723
724 return Encode::undefined();
725}
726
static QV4::ReturnedValue asReturnedValue(const QJSValue *jsval)
Definition qjsvalue_p.h:257
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
\inmodule QtCore
Definition qmetatype.h:341
\inmodule QtCore
Definition qobject.h:103
static QQmlData * get(QObjectPrivate *priv, bool create)
Definition qqmldata_p.h:199
static QQmlEnginePrivate * get(QQmlEngine *e)
T singletonInstance(const QQmlType &type)
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
static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to)
static QQmlMetaObject metaObjectForType(QMetaType metaType)
static QQmlTypeLoader * get(Engine *engine)
const QMetaObject * metaObject() const
Definition qqmltype.cpp:683
static void refHandle(const QQmlTypePrivate *priv)
Definition qqmltype.cpp:812
static void derefHandle(const QQmlTypePrivate *priv)
Definition qqmltype.cpp:818
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
ObjectType::Data * allocate(Args &&... args)
Definition qv4mm_p.h:298
\inmodule QtCore
Definition qvariant.h:65
T value() const &
Definition qvariant.h:516
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:536
Combined button and popup list for selecting options.
void setupQObjectMethodLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self, QObjectMethod *method)
quint64 ReturnedValue
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
Scoped< String > ScopedString
@ Attr_Invalid
@ Attr_Data
bool qualifiesForMethodLookup(const QQmlPropertyData *propertyData)
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]
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:80
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool create)
Definition qqml.cpp:114
static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, const QQmlType &type, bool *ok)
static ReturnedValue instanceOfQObject(const QV4::QQmlTypeWrapper *typeWrapper, const QObjectWrapper *objectWrapper)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
unsigned char quint8
Definition qtypes.h:46
static const uint base
Definition qurlidna.cpp:20
#define DEFINE_OBJECT_VTABLE(classname)
const char property[13]
Definition qwizard.cpp:101
view create()
QJSEngine engine
[0]
\inmodule QtCore \reentrant
Definition qchar.h:18
\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
WriteBarrier::HeapObjectWrapper< CompilationUnitRuntimeData, 1 > compilationUnit
struct QV4::Heap::QQmlTypeWrapper::@673::@676 n
void init(TypeNameMode m, QObject *o, const QQmlTypePrivate *type)
const QQmlImportRef * importNamespace
QQmlTypeNameCache::Result queryNamespace(const QV4::String *name, QQmlEnginePrivate *enginePrivate) const
QV4QPointer< QObject > object
PropertyKey asPropertyKey(const Heap::String *str)
struct QV4::Lookup::@584::@607 qmlEnumValueLookup
ReturnedValue(* getter)(Lookup *l, ExecutionEngine *engine, const Value &object)
Definition qv4lookup_p.h:40
struct QV4::Lookup::@584::@598 qobjectLookup
static ReturnedValue getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object)
struct QV4::Lookup::@584::@599 qobjectMethodLookup
struct QV4::Lookup::@584::@608 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)
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
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
Definition moc.h:23
void wrapper()