6#include <private/qjsvalue_p.h>
7#include <private/qqmlbuiltinfunctions_p.h>
8#include <private/qqmlcomponent_p.h>
9#include <private/qqmlengine_p.h>
10#include <private/qqmlfinalizer_p.h>
11#include <private/qqmlloggingcategorybase_p.h>
12#include <private/qqmlmetatype_p.h>
13#include <private/qqmlmetatypedata_p.h>
14#include <private/qqmltype_p_p.h>
15#include <private/qqmltypemodule_p.h>
16#include <private/qqmltypewrapper_p.h>
17#include <private/qqmlvaluetypewrapper_p.h>
18#include <private/qv4alloca_p.h>
19#include <private/qv4dateobject_p.h>
20#include <private/qv4errorobject_p.h>
21#include <private/qv4identifiertable_p.h>
22#include <private/qv4lookup_p.h>
23#include <private/qv4qobjectwrapper_p.h>
25#include <QtQml/qqmlprivate.h>
27#include <QtCore/qmutex.h>
28#include <QtCore/qsequentialiterable.h>
33
34
35
36
37
38
39
40
41
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
61 QQmlData *data = QQmlData::get(object);
65 || !data->context->engine()
66 || data->deferredData.isEmpty()
67 || data->wasDeleted(object)) {
71 if (!data->propertyCache)
72 data->propertyCache = QQmlMetaType::propertyCache(object->metaObject());
74 QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine());
76 QQmlComponentPrivate::DeferredState state;
77 QQmlComponentPrivate::beginDeferred(ep, object, &state);
80 data->releaseDeferredData();
82 QQmlComponentPrivate::completeDeferred(ep, &state);
87 return QQmlEngine::contextForObject(obj);
92 QQmlData *data = QQmlData::get(obj);
93 if (!data || !data->context)
95 return data->context->engine();
99 QObject *object,
bool create)
104 QObject *rv = data->hasExtendedData() ? data->attachedProperties()->value(pf) : 0;
111 data->attachedProperties()->insert(pf, rv);
117 const QMetaObject *attachedMetaObject)
119 QQmlEngine *engine = object ? qmlEngine(object) :
nullptr;
120 return QQmlMetaType::attachedPropertiesFunc(
121 engine ? QQmlTypeLoader::get(engine) :
nullptr, attachedMetaObject);
129 QQmlData *data = QQmlData::get(object, createIfMissing);
136 return resolveAttachedProperties(func, data, object, createIfMissing);
140
141
142
143
144
145
146
147QObject *qmlExtendedObject(QObject *base)
149 return QQmlPrivate::qmlExtendedObject(base, 0);
152QObject *QQmlPrivate::qmlExtendedObject(QObject *object,
int index)
157 void *result =
nullptr;
158 QObjectPrivate *d = QObjectPrivate::get(object);
162 const int id = d->metaObject->metaCall(
163 object, QMetaObject::CustomCall,
164 QQmlProxyMetaObject::extensionObjectId(index), &result);
165 if (id != QQmlProxyMetaObject::extensionObjectId(index))
168 return static_cast<QObject *>(result);
171void QQmlPrivate::qmlRegistrationWarning(
172 QQmlPrivate::QmlRegistrationWarning warning, QMetaType metaType)
175 case UnconstructibleType:
178 <<
" is neither a default constructible QObject, nor a default- "
179 <<
"and copy-constructible Q_GADGET, nor a QObject marked as uncreatable.\n"
180 <<
"You should not use it as a QML type.";
182 case UnconstructibleSingleton:
184 <<
"Singleton" << metaType.name()
185 <<
"needs to be a concrete class with either a default constructor"
186 <<
"or, when adding a default constructor is infeasible, a public static"
187 <<
"create(QQmlEngine *, QJSEngine *) method.";
189 case NonQObjectWithAtached:
192 <<
"is not a QObject, but has attached properties. This won't work.";
197QMetaType QQmlPrivate::compositeMetaType(
198 QV4::ExecutableCompilationUnit *unit,
int elementNameId)
200 return QQmlTypePrivate::visibleQmlTypeByName(unit, elementNameId).typeId();
203QMetaType QQmlPrivate::compositeMetaType(
204 QV4::ExecutableCompilationUnit *unit,
const QString &elementName)
206 return QQmlTypePrivate::visibleQmlTypeByName(
207 unit->baseCompilationUnit(), elementName, unit->engine->typeLoader())
211QMetaType QQmlPrivate::compositeListMetaType(
212 QV4::ExecutableCompilationUnit *unit,
int elementNameId)
214 return QQmlTypePrivate::visibleQmlTypeByName(unit, elementNameId).qListTypeId();
217QMetaType QQmlPrivate::compositeListMetaType(
218 QV4::ExecutableCompilationUnit *unit,
const QString &elementName)
220 return QQmlTypePrivate::visibleQmlTypeByName(
221 unit->baseCompilationUnit(), elementName, unit->engine->typeLoader())
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265int qmlRegisterUncreatableMetaObject(
const QMetaObject &staticMetaObject,
266 const char *uri,
int versionMajor,
267 int versionMinor,
const char *qmlName,
268 const QString& reason)
270 QQmlPrivate::RegisterType type = {
271 QQmlPrivate::RegisterType::CurrentVersion,
280 uri, QTypeRevision::fromVersion(versionMajor, versionMinor), qmlName, &staticMetaObject,
282 QQmlAttachedPropertiesFunc(),
292 QTypeRevision::zero(),
294 QQmlPrivate::ValueTypeCreationMethod::None
297 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
301
302
303
304
305
306
307
308
309
310void qmlClearTypeRegistrations()
312 QQmlMetaType::clearTypeRegistrations();
313 QQmlEnginePrivate::baseModulesUninitialized =
true;
314 qmlClearEnginePlugins();
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
347 return QQmlMetaType::protectModule(QString::fromUtf8(uri),
348 QTypeRevision::fromMajorVersion(majVersion));
352
353
354
355
356
357
358
359
360
361
365 QQmlMetaType::registerModule(uri, QTypeRevision::fromVersion(versionMajor, versionMinor));
370 if (importMajor == QQmlModuleImportAuto)
371 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Auto);
372 else if (importMajor == QQmlModuleImportLatest)
373 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Default);
374 else if (importMinor == QQmlModuleImportLatest)
375 return QQmlDirParser::Import(uri, QTypeRevision::fromMajorVersion(importMajor), QQmlDirParser::Import::Default);
376 return QQmlDirParser::Import(uri, QTypeRevision::fromVersion(importMajor, importMinor), QQmlDirParser::Import::Default);
381 return moduleMajor == QQmlModuleImportModuleAny
383 : QTypeRevision::fromMajorVersion(moduleMajor);
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
447 const char *import,
int importMajor,
int importMinor)
449 QQmlMetaType::registerModuleImport(
450 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
451 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
456
457
458
459
460
461
462
463
464
465
467 const char *import,
int importMajor,
int importMinor)
469 QQmlMetaType::unregisterModuleImport(
470 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
471 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498int qmlTypeId(
const char *uri,
int versionMajor,
int versionMinor,
const char *qmlName)
500 auto revision = QTypeRevision::fromVersion(versionMajor, versionMinor);
501 int id = QQmlMetaType::typeId(uri, revision, qmlName);
505
506
507
508
509
511 QQmlTypeLoader *typeLoader = QQmlTypeLoader::get(&engine);
512 auto loadHelper = QQml::makeRefPointer<LoadHelper>(
513 typeLoader, uri, qmlName, QQmlTypeLoader::Synchronous);
514 const QQmlType type = loadHelper->type();
515 if (type.availableInVersion(revision))
525 error.setDescription(QStringLiteral(
"The registered singleton has already been deleted. "
526 "Ensure that it outlives the engine."));
527 QQmlEnginePrivate::get(engine)->warning(engine, error);
531 if (engine->thread() != instance->thread()) {
533 error.setDescription(QStringLiteral(
"Registered object must live in the same thread "
534 "as the engine it was registered with"));
535 QQmlEnginePrivate::get(engine)->warning(engine, error);
543#if QT_DEPRECATED_SINCE(6
, 3
)
544QObject *QQmlPrivate::SingletonFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
546 if (!checkSingletonInstance(qeng, m_object))
551 error.setDescription(QStringLiteral(
"Singleton registered by registerSingletonInstance "
552 "must only be accessed from one engine"));
553 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
557 alreadyCalled =
true;
558 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
563QObject *QQmlPrivate::SingletonInstanceFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
565 if (!checkSingletonInstance(qeng, m_object))
570 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
571 }
else if (m_engine != qeng) {
573 error.setDescription(QLatin1String(
"Singleton registered by registerSingletonInstance must only be accessed from one engine"));
574 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
583 QVector<QTypeRevision> revisions;
586 const int propertyOffset = metaObject->propertyOffset();
587 const int propertyCount = metaObject->propertyCount();
588 for (
int coreIndex = propertyOffset, propertyEnd = propertyOffset + propertyCount;
589 coreIndex < propertyEnd; ++coreIndex) {
590 const QMetaProperty property = metaObject->property(coreIndex);
591 if (
int revision = property.revision())
592 revisions.append(QTypeRevision::fromEncodedVersion(revision));
594 const int methodOffset = metaObject->methodOffset();
595 const int methodCount = metaObject->methodCount();
596 for (
int methodIndex = methodOffset, methodEnd = methodOffset + methodCount;
597 methodIndex < methodEnd; ++methodIndex) {
598 const QMetaMethod method = metaObject->method(methodIndex);
599 if (
int revision = method.revision())
600 revisions.append(QTypeRevision::fromEncodedVersion(revision));
604 if (
const QMetaObject *superMeta = metaObject->superClass())
605 revisions += availableRevisions(superMeta);
610template<
typename Registration>
612 QTypeRevision defaultVersion)
614 const quint8 majorVersion = revision.hasMajorVersion() ? revision.majorVersion()
615 : defaultVersion.majorVersion();
616 registration->version = revision.hasMinorVersion()
617 ? QTypeRevision::fromVersion(majorVersion, revision.minorVersion())
618 : QTypeRevision::fromMajorVersion(majorVersion);
619 registration->revision = revision;
624 auto revisions = availableRevisions(metaObject);
625 revisions.append(added);
629static void uniqueRevisions(QVector<QTypeRevision> *revisions, QTypeRevision defaultVersion,
632 bool revisionsHaveMajorVersions =
false;
633 for (QTypeRevision revision : QVector<QTypeRevision>(*revisions)) {
635 if (revision.hasMajorVersion()) {
636 revisionsHaveMajorVersions =
true;
637 if (revision.majorVersion() < defaultVersion.majorVersion())
638 revisions->append(QTypeRevision::fromVersion(revision.majorVersion(), 254));
642 if (revisionsHaveMajorVersions) {
643 if (!added.hasMajorVersion()) {
645 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(),
646 added.minorVersion()));
647 }
else if (added.majorVersion() < defaultVersion.majorVersion()) {
649 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(), 0));
653 std::sort(revisions->begin(), revisions->end());
654 const auto it = std::unique(revisions->begin(), revisions->end());
655 revisions->erase(it, revisions->end());
659 const QQmlPrivate::RegisterSingletonType &type)
661 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
662 siinfo->scriptCallback = type.scriptApi;
663 siinfo->qobjectCallback = type.qObjectApi;
664 siinfo->typeName = type.typeName;
665 return QQmlType::SingletonInstanceInfo::ConstPtr(
666 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
670 const QQmlPrivate::RegisterCompositeSingletonType &type)
672 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
673 siinfo->url = QQmlMetaType::normalizedUrl(type.url);
674 siinfo->typeName = type.typeName;
675 return QQmlType::SingletonInstanceInfo::ConstPtr(
676 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
681 if (!dtype.isValid())
684 QQmlMetaType::registerUndeletableType(dtype);
685 return dtype.index();
688using ElementNames = QVarLengthArray<
const char *, 8>;
691 Q_ASSERT(metaObject);
692 const char *key =
"QML.Element";
694 const int offset = metaObject->classInfoOffset();
695 const int start = metaObject->classInfoCount() + offset - 1;
697 ElementNames elementNames;
699 for (
int i = start; i >= offset; --i) {
700 const QMetaClassInfo classInfo = metaObject->classInfo(i);
701 if (qstrcmp(key, classInfo.name()) == 0) {
702 const char *elementName = classInfo.value();
704 if (qstrcmp(elementName,
"auto") == 0) {
705 const char *strippedClassName = metaObject->className();
706 for (
const char *c = strippedClassName; *c !=
'\0'; c++) {
708 strippedClassName = c + 1;
710 elementName = strippedClassName;
711 }
else if (qstrcmp(elementName,
"anonymous") == 0) {
712 if (elementNames.isEmpty())
713 elementNames.push_back(
nullptr);
714 else if (elementNames[0] !=
nullptr)
715 qWarning() << metaObject->className() <<
"is both anonymous and named";
719 if (!elementNames.isEmpty() && elementNames[0] ==
nullptr) {
720 qWarning() << metaObject->className() <<
"is both anonymous and named";
721 elementNames[0] = elementName;
723 elementNames.push_back(elementName);
738 for (
int i = 1, end = elementNames->length(); i < end; ++i)
739 otherNames.append(QString::fromUtf8(elementNames->at(i)));
740 elementNames =
nullptr;
743 for (
const QString &otherName : std::as_const(otherNames))
744 QQmlMetaType::registerTypeAlias(typeId, otherName);
748 const ElementNames *elementNames;
749 QVarLengthArray<QString, 8> otherNames;
754 const QQmlPrivate::RegisterTypeAndRevisions &type,
755 const ElementNames &elementNames)
757 using namespace QQmlPrivate;
759 const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
760 const bool creatable = (elementNames[0] !=
nullptr || isValueType)
761 && boolClassInfo(type.classInfoMetaObject,
"QML.Creatable",
true);
763 QString noCreateReason;
764 ValueTypeCreationMethod creationMethod = ValueTypeCreationMethod::None;
767 noCreateReason = QString::fromUtf8(
768 classInfo(type.classInfoMetaObject,
"QML.UncreatableReason"));
769 if (noCreateReason.isEmpty())
770 noCreateReason = QLatin1String(
"Type cannot be created in QML.");
771 }
else if (isValueType) {
772 const char *method = classInfo(type.classInfoMetaObject,
"QML.CreationMethod");
773 if (qstrcmp(method,
"structured") == 0)
774 creationMethod = ValueTypeCreationMethod::Structured;
775 else if (qstrcmp(method,
"construct") == 0)
776 creationMethod = ValueTypeCreationMethod::Construct;
779 RegisterType typeRevision = {
780 QQmlPrivate::RegisterType::CurrentVersion,
783 creatable ? type.objectSize : 0,
787 type.createValueType,
792 type.attachedPropertiesFunction,
793 type.attachedPropertiesMetaObject,
794 type.parserStatusCast,
795 type.valueSourceCast,
796 type.valueInterceptorCast,
797 type.extensionObjectCreate,
798 type.extensionMetaObject,
801 type.structVersion > 0 ? type.finalizerCast : -1,
805 QQmlPrivate::RegisterSequentialContainer sequenceRevision = {
811 type.structVersion > 1 ? type.listMetaSequence : QMetaSequence(),
815 const QTypeRevision added = revisionClassInfo(
816 type.classInfoMetaObject,
"QML.AddedInVersion",
817 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
818 const QTypeRevision removed = revisionClassInfo(
819 type.classInfoMetaObject,
"QML.RemovedInVersion");
820 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
823 auto revisions = prepareRevisions(type.metaObject, added) + furtherRevisions;
824 if (type.attachedPropertiesMetaObject)
825 revisions += availableRevisions(type.attachedPropertiesMetaObject);
826 uniqueRevisions(&revisions, type.version, added);
829 for (QTypeRevision revision : revisions) {
830 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
833 assignVersions(&typeRevision, revision, type.version);
836 if (typeRevision.version < added
837 || (removed.isValid() && !(typeRevision.version < removed))) {
838 typeRevision.elementName =
nullptr;
839 typeRevision.create =
nullptr;
840 typeRevision.userdata =
nullptr;
842 typeRevision.elementName = elementNames[0];
843 typeRevision.create = creatable ? type.create :
nullptr;
844 typeRevision.userdata = type.userdata;
847 typeRevision.customParser = type.customParserFactory();
848 const int id = qmlregister(TypeRegistration, &typeRevision);
850 type.qmlTypeIds->append(id);
852 if (typeRevision.elementName)
853 aliasRegistrar.registerAliases(id);
855 if (sequenceRevision.metaSequence != QMetaSequence()) {
856 sequenceRevision.version = typeRevision.version;
857 sequenceRevision.revision = typeRevision.revision;
858 const int id = QQmlPrivate::qmlregister(
859 QQmlPrivate::SequentialContainerRegistration, &sequenceRevision);
861 type.qmlTypeIds->append(id);
867 const QQmlPrivate::RegisterSingletonTypeAndRevisions &type,
868 const ElementNames &elementNames)
870 using namespace QQmlPrivate;
872 RegisterSingletonType revisionRegistration = {
879 type.instanceMetaObject,
881 type.extensionObjectCreate,
882 type.extensionMetaObject,
885 const QQmlType::SingletonInstanceInfo::ConstPtr siinfo
886 = singletonInstanceInfo(revisionRegistration);
888 const QTypeRevision added = revisionClassInfo(
889 type.classInfoMetaObject,
"QML.AddedInVersion",
890 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
891 const QTypeRevision removed = revisionClassInfo(
892 type.classInfoMetaObject,
"QML.RemovedInVersion");
893 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
896 auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions;
897 uniqueRevisions(&revisions, type.version, added);
900 for (QTypeRevision revision : std::as_const(revisions)) {
901 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
904 assignVersions(&revisionRegistration, revision, type.version);
907 if (revisionRegistration.version < added
908 || (removed.isValid() && !(revisionRegistration.version < removed))) {
909 revisionRegistration.typeName =
nullptr;
910 revisionRegistration.qObjectApi =
nullptr;
912 revisionRegistration.typeName = elementNames[0];
913 revisionRegistration.qObjectApi = type.qObjectApi;
916 const int id = finalizeType(
917 QQmlMetaType::registerSingletonType(revisionRegistration, siinfo));
919 type.qmlTypeIds->append(id);
921 if (revisionRegistration.typeName)
922 aliasRegistrar.registerAliases(id);
927
928
929
930int QQmlPrivate::qmlregister(RegistrationType type,
void *data)
933 case AutoParentRegistration:
934 return QQmlMetaType::registerAutoParentFunction(
935 *
reinterpret_cast<RegisterAutoParent *>(data));
936 case QmlUnitCacheHookRegistration:
937 return QQmlMetaType::registerUnitCacheHook(
938 *
reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
939 case TypeAndRevisionsRegistration: {
940 const RegisterTypeAndRevisions &type = *
reinterpret_cast<RegisterTypeAndRevisions *>(data);
941 if (type.structVersion > 1 && type.forceAnonymous) {
942 doRegisterTypeAndRevisions(type, {
nullptr});
944 const ElementNames names = classElementNames(type.classInfoMetaObject);
945 if (names.isEmpty()) {
946 qWarning().nospace() <<
"Missing QML.Element class info for "
947 << type.classInfoMetaObject->className();
949 doRegisterTypeAndRevisions(type, names);
955 case SingletonAndRevisionsRegistration: {
956 const RegisterSingletonTypeAndRevisions &type
957 = *
reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data);
958 const ElementNames names = classElementNames(type.classInfoMetaObject);
959 if (names.isEmpty()) {
960 qWarning().nospace() <<
"Missing QML.Element class info for "
961 << type.classInfoMetaObject->className();
963 doRegisterSingletonAndRevisions(type, names);
967 case SequentialContainerAndRevisionsRegistration: {
968 const RegisterSequentialContainerAndRevisions &type
969 = *
reinterpret_cast<RegisterSequentialContainerAndRevisions *>(data);
970 RegisterSequentialContainer revisionRegistration = {
980 const QTypeRevision added = revisionClassInfo(
981 type.classInfoMetaObject,
"QML.AddedInVersion",
982 QTypeRevision::fromMinorVersion(0));
983 QList<QTypeRevision> revisions = revisionClassInfos(
984 type.classInfoMetaObject,
"QML.ExtraVersion");
985 revisions.append(added);
986 uniqueRevisions(&revisions, type.version, added);
988 for (QTypeRevision revision : std::as_const(revisions)) {
989 if (revision < added)
991 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
994 assignVersions(&revisionRegistration, revision, type.version);
995 const int id = qmlregister(SequentialContainerRegistration, &revisionRegistration);
997 type.qmlTypeIds->append(id);
1001 case TypeRegistration:
1002 return finalizeType(
1003 QQmlMetaType::registerType(*
reinterpret_cast<RegisterType *>(data)));
1004 case InterfaceRegistration:
1005 return finalizeType(
1006 QQmlMetaType::registerInterface(*
reinterpret_cast<RegisterInterface *>(data)));
1007 case SingletonRegistration:
1008 return finalizeType(QQmlMetaType::registerSingletonType(
1009 *
reinterpret_cast<RegisterSingletonType *>(data),
1010 singletonInstanceInfo(*
reinterpret_cast<RegisterSingletonType *>(data))));
1011 case CompositeRegistration:
1012 return finalizeType(QQmlMetaType::registerCompositeType(
1013 *
reinterpret_cast<RegisterCompositeType *>(data)));
1014 case CompositeSingletonRegistration:
1015 return finalizeType(QQmlMetaType::registerCompositeSingletonType(
1016 *
reinterpret_cast<RegisterCompositeSingletonType *>(data),
1017 singletonInstanceInfo(*
reinterpret_cast<RegisterCompositeSingletonType *>(data))));
1018 case SequentialContainerRegistration:
1019 return finalizeType(QQmlMetaType::registerSequentialContainer(
1020 *
reinterpret_cast<RegisterSequentialContainer *>(data)));
1028void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data)
1031 case AutoParentRegistration:
1032 QQmlMetaType::unregisterAutoParentFunction(
reinterpret_cast<AutoParentFunction>(data));
1034 case QmlUnitCacheHookRegistration:
1035 QQmlMetaType::removeCachedUnitLookupFunction(
1036 reinterpret_cast<QmlUnitCacheLookupFunction>(data));
1038 case SequentialContainerRegistration:
1039 QQmlMetaType::unregisterSequentialContainer(data);
1041 case TypeRegistration:
1042 case InterfaceRegistration:
1043 case SingletonRegistration:
1044 case CompositeRegistration:
1045 case CompositeSingletonRegistration:
1046 QQmlMetaType::unregisterType(data);
1048 case TypeAndRevisionsRegistration:
1049 case SingletonAndRevisionsRegistration:
1050 case SequentialContainerAndRevisionsRegistration:
1060QList<QTypeRevision> QQmlPrivate::revisionClassInfos(
const QMetaObject *metaObject,
1063 QList<QTypeRevision> revisions;
1064 for (
int index = indexOfOwnClassInfo(metaObject, key); index != -1;
1065 index = indexOfOwnClassInfo(metaObject, key, index - 1)) {
1066 revisions.push_back(QTypeRevision::fromEncodedVersion(
1067 QLatin1StringView(metaObject->classInfo(index).value()).toInt()));
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106int qmlRegisterTypeNotAvailable(
1107 const char *uri,
int versionMajor,
int versionMinor,
1108 const char *qmlName,
const QString &message)
1111 uri, versionMajor, versionMinor, qmlName, message);
1117 const char *uri,
int versionMajor,
const QMetaObject *classInfoMetaObject,
1118 QVector<
int> *qmlTypeIds,
const QMetaObject *extension,
bool)
1122 RegisterTypeAndRevisions type = {
1124 QmlMetaType<T>::self(),
1125 QmlMetaType<T>::list(),
1132 QTypeRevision::fromMajorVersion(versionMajor),
1134 &QQmlTypeNotAvailable::staticMetaObject,
1135 classInfoMetaObject,
1137 attachedPropertiesFunc<T>(),
1138 attachedPropertiesMetaObject<T>(),
1140 StaticCastSelector<T, QQmlParserStatus>::cast(),
1141 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1142 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1146 qmlCreateCustomParser<T>,
1148 QQmlPrivate::StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1150 QmlMetaType<T>::sequence(),
1153 qmlregister(TypeAndRevisionsRegistration, &type);
1171 QQmlEngine *engine = aotContext->qmlEngine();
1172 return engine ? QQmlEnginePrivate::get(aotContext->qmlEngine())->propertyCapture :
nullptr;
1205static bool markPointer(
const QVariant &element, QV4::MarkStack *markStack)
1207 if (!element.metaType().flags().testFlag(QMetaType::PointerToQObject))
1210 QV4::QObjectWrapper::markWrapper(
1211 *
static_cast<QObject *
const *>(element.constData()), markStack);
1217#define ADD_CASE(Type, id, T)
1218 case QMetaType::Type:
1220 switch (element.metaType().id()) {
1221 case QMetaType::QVariantMap:
1222 for (
const QVariant &variant : *
static_cast<
const QVariantMap *>(element.constData()))
1223 elements->push_back(variant);
1225 case QMetaType::QVariantHash:
1226 for (
const QVariant &variant : *
static_cast<
const QVariantHash *>(element.constData()))
1227 elements->push_back(variant);
1229 case QMetaType::QVariantList:
1230 for (
const QVariant &variant : *
static_cast<
const QVariantList *>(element.constData()))
1231 elements->push_back(variant);
1233 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1234 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1235 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1236 case QMetaType::QStringList:
1237 case QMetaType::QByteArrayList:
1243 QSequentialIterable iterable;
1244 if (!QMetaType::convert(
1245 element.metaType(), element.constData(),
1246 QMetaType::fromType<QSequentialIterable>(), &iterable)) {
1250 switch (iterable.valueMetaType().id()) {
1251 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1252 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1253 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1254 case QMetaType::QStringList:
1255 case QMetaType::QByteArrayList:
1261 for (
auto it = iterable.constBegin(), end = iterable.constEnd(); it != end; ++it)
1262 elements->push_back(*it);
1305static bool inherits(
const QQmlPropertyCache *descendent,
const QQmlPropertyCache *ancestor)
1307 for (
const QQmlPropertyCache *cache = descendent; cache; cache = cache->parent().data()) {
1308 if (cache == ancestor)
1407 void *
a[] = {
target,
nullptr };
1419 void *
a[] = {
source,
nullptr };
1517template<
typename Op>
1545 void *
args[] = {
nullptr };
1562 const bool isUnsigned = enumType.flags() & QMetaType::IsUnsignedEnumeration;
1563 switch (enumType.sizeOf()) {
1566 ? numberType == QMetaType::fromType<quint8>()
1567 : numberType == QMetaType::fromType<qint8>();
1570 ? numberType == QMetaType::fromType<ushort>()
1571 : numberType == QMetaType::fromType<
short>();
1578 ? (numberType == QMetaType::fromType<
int>()
1579 || numberType == QMetaType::fromType<uint>())
1580 : numberType == QMetaType::fromType<
int>();
1583 ? numberType == QMetaType::fromType<qulonglong>()
1584 : numberType == QMetaType::fromType<qlonglong>();
1593 return !type.isValid()
1594 || type == QMetaType::fromType<QVariant>()
1595 || type == QMetaType::fromType<QJSPrimitiveValue>();
1600 if (source == target)
1603 if ((source.flags() & QMetaType::IsQmlList)
1604 && (target.flags() & QMetaType::IsQmlList)) {
1610 if (target.flags() & QMetaType::PointerToQObject) {
1613 const QMetaObject *targetMetaObject = target.metaObject();
1614 const QMetaObject *sourceMetaObject = source.metaObject();
1615 if (!sourceMetaObject)
1616 sourceMetaObject = QQmlMetaType::metaObjectForType(source).metaObject();
1618 while (sourceMetaObject && sourceMetaObject != targetMetaObject)
1619 sourceMetaObject = sourceMetaObject->superClass();
1621 return sourceMetaObject !=
nullptr;
1624 if (target.flags() & QMetaType::IsEnumeration)
1625 return isEnumUnderlyingType(target, source);
1627 if (source.flags() & QMetaType::IsEnumeration)
1628 return isEnumUnderlyingType(source, target);
1630 if (!source.isValid())
1631 return canHoldVoid(target);
1707 const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
1709 QV4::Scope scope(aotContext->engine->handle());
1710 QV4::PropertyKey id = scope.engine->identifierTable->asPropertyKey(
1711 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]);
1713 Q_ASSERT(id.isString());
1715 QV4::ScopedString name(scope, id.asStringOrSymbol());
1717 Q_ASSERT(!name->equals(scope.engine->id_toString()));
1718 Q_ASSERT(!name->equals(scope.engine->id_destroy()));
1720 QQmlData *ddata = QQmlData::get(object,
true);
1722 if (ddata->isQueuedForDeletion)
1725 const QQmlPropertyData *property;
1726 if (!ddata->propertyCache) {
1727 property = QQmlPropertyCache::property(object, name, aotContext->qmlContext,
nullptr);
1729 property = ddata->propertyCache->property(
1730 name.getPointer(), object, aotContext->qmlContext);
1734 const QMetaObject *metaObject = object->metaObject();
1738 const int coreIndex = metaObject->indexOfProperty(
1739 name->toQStringNoThrow().toUtf8().constData());
1743 const QMetaProperty property = metaObject->property(coreIndex);
1745 lookup->releasePropertyCache();
1747 lookup->qobjectFallbackLookup.metaObject = quintptr(metaObject) + 1;
1748 lookup->qobjectFallbackLookup.coreIndex = coreIndex;
1749 lookup->qobjectFallbackLookup.notifyIndex =
1750 QMetaObjectPrivate::signalIndex(property.notifySignal());
1751 lookup->qobjectFallbackLookup.isConstant = property.isConstant() ? 1 : 0;
1755 Q_ASSERT(ddata->propertyCache);
1757 QV4::setupQObjectLookup(lookup, ddata, property);
1763template<QV4::Lookup::Call ObjectCall, QV4::Lookup::Call FallbackCall,
LookupType Type>
1766 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
1767 if (v4->hasException) {
1768 v4->amendException();
1772 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
1773 switch (initObjectLookup(aotContext, lookup, object)) {
1775 lookup->call = ObjectCall;
1779 lookup->call = FallbackCall;
1783 v4->throwTypeError();
1792 QV4::Lookup *lookup, QV4::ExecutableCompilationUnit *compilationUnit,
1793 const QMetaObject *metaObject)
1795 Q_ASSERT(metaObject);
1796 const QByteArray name = compilationUnit->runtimeStrings[lookup->nameIndex]->toQString().toUtf8();
1797 const int coreIndex = metaObject->indexOfProperty(name.constData());
1798 QMetaType lookupType = metaObject->property(coreIndex).metaType();
1799 lookup->qgadgetLookup.metaObject = quintptr(metaObject) + 1;
1800 lookup->qgadgetLookup.coreIndex = coreIndex;
1801 lookup->qgadgetLookup.metaType = lookupType.iface();
1865#if QT_CONFIG(translation)
1916 if (type == QMetaType::fromType<QVariant>())
1917 return !
static_cast<
const QVariant *>(value)->isValid();
1918 if (type == QMetaType::fromType<QJSValue>())
1919 return static_cast<
const QJSValue *>(value)->isUndefined();
1920 if (type == QMetaType::fromType<QJSPrimitiveValue>()) {
1921 return static_cast<
const QJSPrimitiveValue *>(value)->type()
1922 == QJSPrimitiveValue::Undefined;
2023 QStringLiteral(
"Value is null and could not be converted to an object"));
2049 QStringLiteral(
"A QmlLoggingCatgory was provided without a valid name"));
2117 const QQmlType &type,
const QV4::CompiledData::ParameterType ¶meter)
2119 return parameter.isList() ? type.qListTypeId() : type.typeId();
2168 for (
int i = 0;
i <
argc; ++
i)
2265 QV4::QObjectMethod *method, QV4::Lookup *lookup,
int relativeMethodIndex)
2267 Q_ASSERT(lookup->qobjectMethodLookup.method.get() == method->d());
2269 const auto *d = method->d();
2270 const int methodCount = d->methodCount;
2272 if (relativeMethodIndex == -1 && methodCount == 1) {
2276 Q_ASSERT(d->methods[0].metaMethod().methodType() == QMetaMethod::Signal);
2277 lookup->qobjectMethodLookup.propertyData = d->methods;
2281 for (
int i = 0, end = d->methodCount; i != end; ++i) {
2282 const QMetaMethod metaMethod = d->methods[i].metaMethod();
2283 if (metaMethod.relativeMethodIndex() != relativeMethodIndex)
2286 lookup->qobjectMethodLookup.propertyData = d->methods + i;
2505 QStringLiteral(
"Property '%1' of object [object Object] is not a function")
2656template<QV4::Lookup::Call call>
2657static void initTypeWrapperLookup(
2658 const AOTCompiledContext *context, QV4::Lookup *lookup, uint importNamespace)
2660 Q_ASSERT(!context->engine->hasError());
2661 if (importNamespace != AOTCompiledContext::InvalidStringId) {
2662 QV4::Scope scope(context->engine->handle());
2663 QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]);
2665 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2666 Q_ASSERT(typeLoader);
2667 if (
const QQmlImportRef *importRef
2668 = context->qmlContext->imports()->query(import, typeLoader).importNamespace) {
2670 QV4::Scoped<QV4::QQmlTypeWrapper> wrapper(
2671 scope, QV4::QQmlTypeWrapper::create(
2672 scope.engine,
nullptr, context->qmlContext->imports(), importRef));
2675 wrapper = lookup->getter(context->engine->handle(), wrapper);
2678 lookup->releasePropertyCache();
2680 lookup->call = call;
2682 case QV4::Lookup::Call::ContextGetterSingleton:
2683 lookup->qmlContextSingletonLookup.singletonObject.set(scope.engine, wrapper->heapObject());
2685 case QV4::Lookup::Call::ContextGetterType:
2686 lookup->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->heapObject());
2693 scope.engine->throwTypeError();
2695 QV4::ExecutionEngine *v4 = context->engine->handle();
2696 lookup->contextGetter(v4,
nullptr);
2697 if (lookup->call != call) {
2699 = QLatin1String(call == QV4::Lookup::Call::ContextGetterSingleton
2700 ?
"%1 was a singleton at compile time, "
2701 "but is not a singleton anymore."
2702 :
"%1 was not a singleton at compile time, "
2703 "but is a singleton now.")
2704 .arg(context->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString());
2705 v4->throwTypeError(error);
2983 QStringLiteral(
"Value is null and could not be converted to an object"));
3036 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target,
void *value)
3038 void *args[] = { value,
nullptr };
3039 metaObject->d.static_metacall(
3040 reinterpret_cast<QObject *>(target), QMetaObject::WriteProperty,
3041 lookup->qgadgetLookup.coreIndex, args);
3046 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target, QV4::ExecutionEngine *v4)
3048 const QMetaProperty property = metaObject->property(lookup->qgadgetLookup.coreIndex);
3049 if (property.isResettable()) {
3050 void *args[] = {
nullptr };
3051 metaObject->d.static_metacall(
3052 reinterpret_cast<QObject *>(target), QMetaObject::ResetProperty,
3053 lookup->qgadgetLookup.coreIndex, args);
3056 QLatin1String(
"Cannot assign [undefined] to ") +
3057 QLatin1String(property.metaType().name()));
3064 QV4::ExecutionEngine *v4, QV4::Lookup *lookup,
const QMetaObject *metaObject,
3065 void *target,
void *value)
3067 QVariant *variant =
static_cast<QVariant *>(value);
3068 const QMetaType propType = metaObject->property(lookup->qgadgetLookup.coreIndex).metaType();
3069 if (propType == QMetaType::fromType<QVariant>())
3070 return storeValueProperty(lookup, metaObject, target, variant);
3072 if (!variant->isValid())
3073 return resetValueProperty(lookup, metaObject, target, v4);
3075 if (isTypeCompatible(variant->metaType(), propType))
3076 return storeValueProperty(lookup, metaObject, target, variant->data());
3078 QVariant converted(propType);
3079 QV4::Scope scope(v4);
3080 QV4::ScopedValue val(scope, v4->fromVariant(*variant));
3081 if (v4->metaTypeFromJS(val, propType, converted.data())
3082 || QMetaType::convert(
3083 variant->metaType(), variant->constData(), propType, converted.data())) {
3084 return storeValueProperty(lookup, metaObject, target, converted.data());
3088 QLatin1String(
"Cannot assign ") + QLatin1String(variant->metaType().name())
3089 + QLatin1String(
" to ") + QLatin1String(propType.name()));
3121void initValueLookup(
3122 const AOTCompiledContext *aotContext, uint index,
const QMetaObject *metaObject)
3124 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
3125 if (v4->hasException) {
3126 v4->amendException();
3130 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
3131 initValueLookup(lookup, aotContext->compilationUnit, metaObject);
3132 lookup->call = QV4::Lookup::Call::SetterValueTypeProperty;
3194
3195
3196
3197
3198
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
PropertyResult loadFallbackAsVariant(QV4::Lookup *lookup, QObject *object, void *target, const AOTCompiledContext *aotContext)
PropertyResult writeBackObjectAsVariant(QV4::Lookup *lookup, QObject *object, void *source)
static PropertyResult writeBackFallbackProperty(QV4::Lookup *lookup, QObject *object, void *source)
static PropertyResult changeFallbackProperty(QV4::Lookup *lookup, QObject *object, Op op)
static FallbackPropertyQmlData findFallbackPropertyQmlData(QV4::Lookup *lookup, QObject *object)
static bool markPointer(const QVariant &element, QV4::MarkStack *markStack)
PropertyResult loadObjectProperty(QV4::Lookup *lookup, QObject *object, void *target, const AOTCompiledContext *aotContext)
static bool isEnumUnderlyingType(QMetaType enumType, QMetaType numberType)
static PropertyResult storeFallbackAsVariant(QV4::ExecutionEngine *v4, QV4::Lookup *lookup, QObject *object, void *value)
static void iterateVariant(const QVariant &element, std::vector< QVariant > *elements)
static PropertyResult resetFallbackProperty(QV4::Lookup *l, QObject *object, const QMetaProperty *property, QV4::ExecutionEngine *v4)
static PropertyResult changeObjectProperty(QV4::Lookup *lookup, QObject *object, Op op)
static PropertyResult storeObjectProperty(QV4::Lookup *l, QObject *object, void *value)
PropertyResult loadObjectAsVariant(QV4::Lookup *lookup, QObject *object, void *target, const AOTCompiledContext *aotContext)
static bool callQObjectMethod(QV4::ExecutionEngine *engine, QV4::Lookup *lookup, QObject *thisObject, void **args, int argc)
ObjectPropertyQmlData findObjectPropertyQmlData(QV4::Lookup *lookup, QObject *object)
static PropertyResult resetObjectProperty(QV4::Lookup *l, QObject *object, QV4::ExecutionEngine *v4)
static void captureFallbackProperty(QObject *object, int coreIndex, int notifyIndex, bool isConstant, const AOTCompiledContext *aotContext)
static void initValueLookup(QV4::Lookup *lookup, QV4::ExecutableCompilationUnit *compilationUnit, const QMetaObject *metaObject)
static bool inherits(const QQmlPropertyCache *descendent, const QQmlPropertyCache *ancestor)
static bool canHoldVoid(QMetaType type)
static PropertyResult storeFallbackProperty(QV4::Lookup *l, QObject *object, void *value)
static bool tryEnsureMethodsCache(QV4::QObjectMethod *method, QObject *object)
static void captureObjectProperty(QObject *object, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *property, const AOTCompiledContext *aotContext)
PropertyResult writeBackFallbackAsVariant(QV4::Lookup *lookup, QObject *object, void *source)
static bool isUndefined(const void *value, QMetaType type)
static bool callQObjectMethodAsVariant(QV4::ExecutionEngine *engine, QV4::Lookup *lookup, QObject *thisObject, void **args, int argc)
static QMetaType jsTypedFunctionArgument(const QQmlType &type, const QV4::CompiledData::ParameterType ¶meter)
static ObjectLookupResult initObjectLookup(const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
static PropertyResult loadFallbackProperty(QV4::Lookup *lookup, QObject *object, void *target, const AOTCompiledContext *aotContext)
static bool callArrowFunction(QV4::ExecutionEngine *engine, QV4::ArrowFunction *function, QObject *thisObject, void **args, int argc)
static PropertyResult storeObjectAsVariant(QV4::ExecutionEngine *v4, QV4::Lookup *lookup, QObject *object, void *value)
static bool callQObjectMethodWithTypes(QV4::ExecutionEngine *engine, QV4::Lookup *lookup, QObject *thisObject, void **args, QMetaType *types, int argc)
static bool isTypeCompatible(QMetaType source, QMetaType target)
void qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QVector< int > *qmlTypeIds, const QMetaObject *extension, bool)
PropertyResult writeBackObjectProperty(QV4::Lookup *lookup, QObject *object, void *source)
void initObjectLookup(const AOTCompiledContext *aotContext, uint index, QObject *object)
static QQmlPropertyCapture * propertyCapture(const AOTCompiledContext *aotContext)
static MatchScore resolveQObjectMethodOverload(QV4::QObjectMethod *method, QV4::Lookup *lookup, int relativeMethodIndex)
QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *object, const QMetaObject *attachedMetaObject)
static void doRegisterSingletonAndRevisions(const QQmlPrivate::RegisterSingletonTypeAndRevisions &type, const ElementNames &elementNames)
static ElementNames classElementNames(const QMetaObject *metaObject)
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool createIfMissing)
void assignVersions(Registration *registration, QTypeRevision revision, QTypeRevision defaultVersion)
static int finalizeType(const QQmlType &dtype)
QQmlEngine * qmlEngine(const QObject *obj)
static QVector< QTypeRevision > availableRevisions(const QMetaObject *metaObject)
QQmlContext * qmlContext(const QObject *obj)
static QObject * resolveAttachedProperties(QQmlAttachedPropertiesFunc pf, QQmlData *data, QObject *object, bool create)
static void uniqueRevisions(QVector< QTypeRevision > *revisions, QTypeRevision defaultVersion, QTypeRevision added)
QT_BEGIN_NAMESPACE void qmlExecuteDeferred(QObject *object)
\inmodule QtQml \title Functions to register C++ types to QML
static QQmlDirParser::Import resolveImport(const QString &uri, int importMajor, int importMinor)
static bool checkSingletonInstance(QQmlEngine *engine, QObject *instance)
static void doRegisterTypeAndRevisions(const QQmlPrivate::RegisterTypeAndRevisions &type, const ElementNames &elementNames)
static QVector< QTypeRevision > prepareRevisions(const QMetaObject *metaObject, QTypeRevision added)
static QTypeRevision resolveModuleVersion(int moduleMajor)
static QQmlType::SingletonInstanceInfo::ConstPtr singletonInstanceInfo(const QQmlPrivate::RegisterSingletonType &type)
Q_QML_EXPORT void qmlRegisterModuleImport(const char *uri, int moduleMajor, const char *import, int importMajor=QQmlModuleImportLatest, int importMinor=QQmlModuleImportLatest)
Q_QML_EXPORT bool qmlProtectModule(const char *uri, int majVersion)
Q_QML_EXPORT void qmlUnregisterModuleImport(const char *uri, int moduleMajor, const char *import, int importMajor=QQmlModuleImportLatest, int importMinor=QQmlModuleImportLatest)
Q_QML_EXPORT void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor)
AliasRegistrar(const ElementNames *elementNames)
void registerAliases(int typeId)
const QMetaObject * metaObject