7#include <private/qjsvalue_p.h>
8#include <private/qqmlbuiltinfunctions_p.h>
9#include <private/qqmlcomponent_p.h>
10#include <private/qqmlengine_p.h>
11#include <private/qqmlfinalizer_p.h>
12#include <private/qqmlloggingcategorybase_p.h>
13#include <private/qqmlmetatype_p.h>
14#include <private/qqmlmetatypedata_p.h>
15#include <private/qqmltype_p_p.h>
16#include <private/qqmltypemodule_p.h>
17#include <private/qqmltypewrapper_p.h>
18#include <private/qqmlvaluetypewrapper_p.h>
19#include <private/qv4alloca_p.h>
20#include <private/qv4dateobject_p.h>
21#include <private/qv4errorobject_p.h>
22#include <private/qv4identifiertable_p.h>
23#include <private/qv4lookup_p.h>
24#include <private/qv4qobjectwrapper_p.h>
26#include <QtQml/qqmlprivate.h>
28#include <QtCore/qmutex.h>
29#include <QtCore/qmetasequence.h>
34
35
36
37
38
39
40
41
42
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
62 QQmlData *data = QQmlData::get(object);
66 || !data->context->engine()
67 || data->deferredData.isEmpty()
68 || data->wasDeleted(object)) {
72 if (!data->propertyCache)
73 data->propertyCache = QQmlMetaType::propertyCache(object->metaObject());
75 QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine());
77 QQmlComponentPrivate::DeferredState state;
78 QQmlComponentPrivate::beginDeferred(ep, object, &state);
81 data->releaseDeferredData();
83 QQmlComponentPrivate::completeDeferred(ep, &state);
88 return QQmlEngine::contextForObject(obj);
93 QQmlData *data = QQmlData::get(obj);
94 if (!data || !data->context)
96 return data->context->engine();
100 QObject *object,
bool create)
105 QObject *rv = data->hasExtendedData() ? data->attachedProperties()->value(pf) : 0;
112 data->attachedProperties()->insert(pf, rv);
118 const QMetaObject *attachedMetaObject)
120 QQmlEngine *engine = object ? qmlEngine(object) :
nullptr;
121 return QQmlMetaType::attachedPropertiesFunc(
122 engine ? QQmlTypeLoader::get(engine) :
nullptr, attachedMetaObject);
130 QQmlData *data = QQmlData::get(object, createIfMissing);
137 return resolveAttachedProperties(func, data, object, createIfMissing);
141
142
143
144
145
146
147
148QObject *qmlExtendedObject(QObject *base)
150 return QQmlPrivate::qmlExtendedObject(base, 0);
153QObject *QQmlPrivate::qmlExtendedObject(QObject *object,
int index)
158 void *result =
nullptr;
159 QObjectPrivate *d = QObjectPrivate::get(object);
163 const int id = d->metaObject->metaCall(
164 object, QMetaObject::CustomCall,
165 QQmlProxyMetaObject::extensionObjectId(index), &result);
166 if (id != QQmlProxyMetaObject::extensionObjectId(index))
169 return static_cast<QObject *>(result);
172void QQmlPrivate::qmlRegistrationWarning(
173 QQmlPrivate::QmlRegistrationWarning warning, QMetaType metaType)
176 case UnconstructibleType:
179 <<
" is neither a default constructible QObject, nor a default- "
180 <<
"and copy-constructible Q_GADGET, nor a QObject marked as uncreatable.\n"
181 <<
"You should not use it as a QML type.";
183 case UnconstructibleSingleton:
185 <<
"Singleton" << metaType.name()
186 <<
"needs to be a concrete class with either a default constructor"
187 <<
"or, when adding a default constructor is infeasible, a public static"
188 <<
"create(QQmlEngine *, QJSEngine *) method.";
190 case NonQObjectWithAtached:
193 <<
"is not a QObject, but has attached properties. This won't work.";
198QMetaType QQmlPrivate::compositeMetaType(
199 QV4::ExecutableCompilationUnit *unit,
int elementNameId)
201 return QQmlTypePrivate::visibleQmlTypeByName(unit, elementNameId).typeId();
204QMetaType QQmlPrivate::compositeMetaType(
205 QV4::ExecutableCompilationUnit *unit,
const QString &elementName)
207 return QQmlTypePrivate::visibleQmlTypeByName(
208 unit->baseCompilationUnit(), elementName, unit->engine->typeLoader())
212QMetaType QQmlPrivate::compositeListMetaType(
213 QV4::ExecutableCompilationUnit *unit,
int elementNameId)
215 return QQmlTypePrivate::visibleQmlTypeByName(unit, elementNameId).qListTypeId();
218QMetaType QQmlPrivate::compositeListMetaType(
219 QV4::ExecutableCompilationUnit *unit,
const QString &elementName)
221 return QQmlTypePrivate::visibleQmlTypeByName(
222 unit->baseCompilationUnit(), elementName, unit->engine->typeLoader())
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
265
266int qmlRegisterUncreatableMetaObject(
const QMetaObject &staticMetaObject,
267 const char *uri,
int versionMajor,
268 int versionMinor,
const char *qmlName,
269 const QString& reason)
271 QQmlPrivate::RegisterType type = {
272 QQmlPrivate::RegisterType::CurrentVersion,
281 uri, QTypeRevision::fromVersion(versionMajor, versionMinor), qmlName, &staticMetaObject,
283 QQmlAttachedPropertiesFunc(),
293 QTypeRevision::zero(),
295 QQmlPrivate::ValueTypeCreationMethod::None
298 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
302
303
304
305
306
307
308
309
310
311
312
313void qmlClearTypeRegistrations()
315 QQmlMetaType::clearTypeRegistrations();
316 QQmlEnginePrivate::baseModulesUninitialized =
true;
317 qmlClearEnginePlugins();
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
350 return QQmlMetaType::protectModule(QString::fromUtf8(uri),
351 QTypeRevision::fromMajorVersion(majVersion));
355
356
357
358
359
360
361
362
363
364
368 QQmlMetaType::registerModule(uri, QTypeRevision::fromVersion(versionMajor, versionMinor));
373 if (importMajor == QQmlModuleImportAuto)
374 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Auto);
375 else if (importMajor == QQmlModuleImportLatest)
376 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Default);
377 else if (importMinor == QQmlModuleImportLatest)
378 return QQmlDirParser::Import(uri, QTypeRevision::fromMajorVersion(importMajor), QQmlDirParser::Import::Default);
379 return QQmlDirParser::Import(uri, QTypeRevision::fromVersion(importMajor, importMinor), QQmlDirParser::Import::Default);
384 return moduleMajor == QQmlModuleImportModuleAny
386 : QTypeRevision::fromMajorVersion(moduleMajor);
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
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
446
447
448
450 const char *import,
int importMajor,
int importMinor)
452 QQmlMetaType::registerModuleImport(
453 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
454 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
459
460
461
462
463
464
465
466
467
468
470 const char *import,
int importMajor,
int importMinor)
472 QQmlMetaType::unregisterModuleImport(
473 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
474 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501int qmlTypeId(
const char *uri,
int versionMajor,
int versionMinor,
const char *qmlName)
503 auto revision = QTypeRevision::fromVersion(versionMajor, versionMinor);
504 int id = QQmlMetaType::typeId(uri, revision, qmlName);
508
509
510
511
512
514 QQmlTypeLoader *typeLoader = QQmlTypeLoader::get(&engine);
515 auto loadHelper = QQml::makeRefPointer<LoadHelper>(
516 typeLoader, uri, qmlName, QQmlTypeLoader::Synchronous);
517 const QQmlType type = loadHelper->type();
518 if (type.availableInVersion(revision))
528 error.setDescription(QStringLiteral(
"The registered singleton has already been deleted. "
529 "Ensure that it outlives the engine."));
530 QQmlEnginePrivate::get(engine)->warning(engine, error);
534 if (engine->thread() != instance->thread()) {
536 error.setDescription(QStringLiteral(
"Registered object must live in the same thread "
537 "as the engine it was registered with"));
538 QQmlEnginePrivate::get(engine)->warning(engine, error);
546#if QT_DEPRECATED_SINCE(6
, 3
)
547QObject *QQmlPrivate::SingletonFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
549 if (!checkSingletonInstance(qeng, m_object))
554 error.setDescription(QStringLiteral(
"Singleton registered by registerSingletonInstance "
555 "must only be accessed from one engine"));
556 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
560 alreadyCalled =
true;
561 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
566QObject *QQmlPrivate::SingletonInstanceFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
568 if (!checkSingletonInstance(qeng, m_object))
573 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
574 }
else if (m_engine != qeng) {
576 error.setDescription(QLatin1String(
"Singleton registered by registerSingletonInstance must only be accessed from one engine"));
577 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
586 QList<QTypeRevision> revisions;
589 const int propertyOffset = metaObject->propertyOffset();
590 const int propertyCount = metaObject->propertyCount();
591 for (
int coreIndex = propertyOffset, propertyEnd = propertyOffset + propertyCount;
592 coreIndex < propertyEnd; ++coreIndex) {
593 const QMetaProperty property = metaObject->property(coreIndex);
594 if (
int revision = property.revision())
595 revisions.append(QTypeRevision::fromEncodedVersion(revision));
597 const int methodOffset = metaObject->methodOffset();
598 const int methodCount = metaObject->methodCount();
599 for (
int methodIndex = methodOffset, methodEnd = methodOffset + methodCount;
600 methodIndex < methodEnd; ++methodIndex) {
601 const QMetaMethod method = metaObject->method(methodIndex);
602 if (
int revision = method.revision())
603 revisions.append(QTypeRevision::fromEncodedVersion(revision));
607 if (
const QMetaObject *superMeta = metaObject->superClass())
608 revisions += availableRevisions(superMeta);
613template<
typename Registration>
615 QTypeRevision defaultVersion)
617 const quint8 majorVersion = revision.hasMajorVersion() ? revision.majorVersion()
618 : defaultVersion.majorVersion();
619 registration->version = revision.hasMinorVersion()
620 ? QTypeRevision::fromVersion(majorVersion, revision.minorVersion())
621 : QTypeRevision::fromMajorVersion(majorVersion);
622 registration->revision = revision;
627 auto revisions = availableRevisions(metaObject);
628 revisions.append(added);
632static void uniqueRevisions(QList<QTypeRevision> *revisions, QTypeRevision defaultVersion,
635 bool revisionsHaveMajorVersions =
false;
636 for (QTypeRevision revision : QList<QTypeRevision>(*revisions)) {
638 if (revision.hasMajorVersion()) {
639 revisionsHaveMajorVersions =
true;
640 if (revision.majorVersion() < defaultVersion.majorVersion())
641 revisions->append(QTypeRevision::fromVersion(revision.majorVersion(), 254));
645 if (revisionsHaveMajorVersions) {
646 if (!added.hasMajorVersion()) {
648 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(),
649 added.minorVersion()));
650 }
else if (added.majorVersion() < defaultVersion.majorVersion()) {
652 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(), 0));
656 std::sort(revisions->begin(), revisions->end());
657 const auto it = std::unique(revisions->begin(), revisions->end());
658 revisions->erase(it, revisions->end());
662 const QQmlPrivate::RegisterSingletonType &type)
664 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
665 siinfo->scriptCallback = type.scriptApi;
666 siinfo->qobjectCallback = type.qObjectApi;
667 siinfo->typeName = type.typeName;
668 return QQmlType::SingletonInstanceInfo::ConstPtr(
669 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
673 const QQmlPrivate::RegisterCompositeSingletonType &type)
675 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
676 siinfo->url = QQmlMetaType::normalizedUrl(type.url);
677 siinfo->typeName = type.typeName;
678 return QQmlType::SingletonInstanceInfo::ConstPtr(
679 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
684 if (!dtype.isValid())
687 QQmlMetaType::registerUndeletableType(dtype);
688 return dtype.index();
691using ElementNames = QVarLengthArray<
const char *, 8>;
694 Q_ASSERT(metaObject);
695 const char *key =
"QML.Element";
697 const int offset = metaObject->classInfoOffset();
698 const int start = metaObject->classInfoCount() + offset - 1;
700 ElementNames elementNames;
702 for (
int i = start; i >= offset; --i) {
703 const QMetaClassInfo classInfo = metaObject->classInfo(i);
704 if (qstrcmp(key, classInfo.name()) == 0) {
705 const char *elementName = classInfo.value();
707 if (qstrcmp(elementName,
"auto") == 0) {
708 const char *strippedClassName = metaObject->className();
709 for (
const char *c = strippedClassName; *c !=
'\0'; c++) {
711 strippedClassName = c + 1;
713 elementName = strippedClassName;
714 }
else if (qstrcmp(elementName,
"anonymous") == 0) {
715 if (elementNames.isEmpty())
716 elementNames.push_back(
nullptr);
717 else if (elementNames[0] !=
nullptr)
718 qWarning() << metaObject->className() <<
"is both anonymous and named";
722 if (!elementNames.isEmpty() && elementNames[0] ==
nullptr) {
723 qWarning() << metaObject->className() <<
"is both anonymous and named";
724 elementNames[0] = elementName;
726 elementNames.push_back(elementName);
741 for (
int i = 1, end = elementNames->length(); i < end; ++i)
742 otherNames.append(QString::fromUtf8(elementNames->at(i)));
743 elementNames =
nullptr;
746 for (
const QString &otherName : std::as_const(otherNames))
747 QQmlMetaType::registerTypeAlias(typeId, otherName);
751 const ElementNames *elementNames;
752 QVarLengthArray<QString, 8> otherNames;
757 const QQmlPrivate::RegisterTypeAndRevisions &type,
758 const ElementNames &elementNames)
760 using namespace QQmlPrivate;
762 const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
763 const bool creatable = (elementNames[0] !=
nullptr || isValueType)
764 && boolClassInfo(type.classInfoMetaObject,
"QML.Creatable",
true);
766 QString noCreateReason;
767 ValueTypeCreationMethod creationMethod = ValueTypeCreationMethod::None;
770 noCreateReason = QString::fromUtf8(
771 classInfo(type.classInfoMetaObject,
"QML.UncreatableReason"));
772 if (noCreateReason.isEmpty())
773 noCreateReason = QLatin1String(
"Type cannot be created in QML.");
774 }
else if (isValueType) {
775 const char *method = classInfo(type.classInfoMetaObject,
"QML.CreationMethod");
776 if (qstrcmp(method,
"structured") == 0)
777 creationMethod = ValueTypeCreationMethod::Structured;
778 else if (qstrcmp(method,
"construct") == 0)
779 creationMethod = ValueTypeCreationMethod::Construct;
782 RegisterType typeRevision = {
783 QQmlPrivate::RegisterType::CurrentVersion,
786 creatable ? type.objectSize : 0,
790 type.createValueType,
795 type.attachedPropertiesFunction,
796 type.attachedPropertiesMetaObject,
797 type.parserStatusCast,
798 type.valueSourceCast,
799 type.valueInterceptorCast,
800 type.extensionObjectCreate,
801 type.extensionMetaObject,
804 type.structVersion > 0 ? type.finalizerCast : -1,
808 QQmlPrivate::RegisterSequentialContainer sequenceRevision = {
814 type.structVersion > 1 ? type.listMetaSequence : QMetaSequence(),
818 const QTypeRevision added = revisionClassInfo(
819 type.classInfoMetaObject,
"QML.AddedInVersion",
820 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
821 const QTypeRevision removed = revisionClassInfo(
822 type.classInfoMetaObject,
"QML.RemovedInVersion");
823 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
826 auto revisions = prepareRevisions(type.metaObject, added) + furtherRevisions;
827 if (type.attachedPropertiesMetaObject)
828 revisions += availableRevisions(type.attachedPropertiesMetaObject);
829 uniqueRevisions(&revisions, type.version, added);
832 for (QTypeRevision revision : std::as_const(revisions)) {
833 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
836 assignVersions(&typeRevision, revision, type.version);
839 if (typeRevision.version < added
840 || (removed.isValid() && !(typeRevision.version < removed))) {
841 typeRevision.elementName =
nullptr;
842 typeRevision.create =
nullptr;
843 typeRevision.userdata =
nullptr;
845 typeRevision.elementName = elementNames[0];
846 typeRevision.create = creatable ? type.create :
nullptr;
847 typeRevision.userdata = type.userdata;
850 typeRevision.customParser = type.customParserFactory();
851 const int id = qmlregister(TypeRegistration, &typeRevision);
853 type.qmlTypeIds->append(id);
855 if (typeRevision.elementName)
856 aliasRegistrar.registerAliases(id);
858 if (sequenceRevision.metaSequence != QMetaSequence()) {
859 sequenceRevision.version = typeRevision.version;
860 sequenceRevision.revision = typeRevision.revision;
861 const int id = QQmlPrivate::qmlregister(
862 QQmlPrivate::SequentialContainerRegistration, &sequenceRevision);
864 type.qmlTypeIds->append(id);
870 const QQmlPrivate::RegisterSingletonTypeAndRevisions &type,
871 const ElementNames &elementNames)
873 using namespace QQmlPrivate;
875 RegisterSingletonType revisionRegistration = {
882 type.instanceMetaObject,
884 type.extensionObjectCreate,
885 type.extensionMetaObject,
888 const QQmlType::SingletonInstanceInfo::ConstPtr siinfo
889 = singletonInstanceInfo(revisionRegistration);
891 const QTypeRevision added = revisionClassInfo(
892 type.classInfoMetaObject,
"QML.AddedInVersion",
893 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
894 const QTypeRevision removed = revisionClassInfo(
895 type.classInfoMetaObject,
"QML.RemovedInVersion");
896 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
899 auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions;
900 uniqueRevisions(&revisions, type.version, added);
903 for (QTypeRevision revision : std::as_const(revisions)) {
904 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
907 assignVersions(&revisionRegistration, revision, type.version);
910 if (revisionRegistration.version < added
911 || (removed.isValid() && !(revisionRegistration.version < removed))) {
912 revisionRegistration.typeName =
nullptr;
913 revisionRegistration.qObjectApi =
nullptr;
915 revisionRegistration.typeName = elementNames[0];
916 revisionRegistration.qObjectApi = type.qObjectApi;
919 const int id = finalizeType(
920 QQmlMetaType::registerSingletonType(revisionRegistration, siinfo));
922 type.qmlTypeIds->append(id);
924 if (revisionRegistration.typeName)
925 aliasRegistrar.registerAliases(id);
930
931
932
933int QQmlPrivate::qmlregister(RegistrationType type,
void *data)
936 case AutoParentRegistration:
937 return QQmlMetaType::registerAutoParentFunction(
938 *
reinterpret_cast<RegisterAutoParent *>(data));
939 case QmlUnitCacheHookRegistration:
940 return QQmlMetaType::registerUnitCacheHook(
941 *
reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
942 case TypeAndRevisionsRegistration: {
943 const RegisterTypeAndRevisions &type = *
reinterpret_cast<RegisterTypeAndRevisions *>(data);
944 if (type.structVersion > 1 && type.forceAnonymous) {
945 doRegisterTypeAndRevisions(type, {
nullptr});
947 const ElementNames names = classElementNames(type.classInfoMetaObject);
948 if (names.isEmpty()) {
949 qWarning().nospace() <<
"Missing QML.Element class info for "
950 << type.classInfoMetaObject->className();
952 doRegisterTypeAndRevisions(type, names);
958 case SingletonAndRevisionsRegistration: {
959 const RegisterSingletonTypeAndRevisions &type
960 = *
reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data);
961 const ElementNames names = classElementNames(type.classInfoMetaObject);
962 if (names.isEmpty()) {
963 qWarning().nospace() <<
"Missing QML.Element class info for "
964 << type.classInfoMetaObject->className();
966 doRegisterSingletonAndRevisions(type, names);
970 case SequentialContainerAndRevisionsRegistration: {
971 const RegisterSequentialContainerAndRevisions &type
972 = *
reinterpret_cast<RegisterSequentialContainerAndRevisions *>(data);
973 RegisterSequentialContainer revisionRegistration = {
983 const QTypeRevision added = revisionClassInfo(
984 type.classInfoMetaObject,
"QML.AddedInVersion",
985 QTypeRevision::fromMinorVersion(0));
986 QList<QTypeRevision> revisions = revisionClassInfos(
987 type.classInfoMetaObject,
"QML.ExtraVersion");
988 revisions.append(added);
989 uniqueRevisions(&revisions, type.version, added);
991 for (QTypeRevision revision : std::as_const(revisions)) {
992 if (revision < added)
994 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
997 assignVersions(&revisionRegistration, revision, type.version);
998 const int id = qmlregister(SequentialContainerRegistration, &revisionRegistration);
1000 type.qmlTypeIds->append(id);
1004 case TypeRegistration:
1005 return finalizeType(
1006 QQmlMetaType::registerType(*
reinterpret_cast<RegisterType *>(data)));
1007 case InterfaceRegistration:
1008 return finalizeType(
1009 QQmlMetaType::registerInterface(*
reinterpret_cast<RegisterInterface *>(data)));
1010 case SingletonRegistration:
1011 return finalizeType(QQmlMetaType::registerSingletonType(
1012 *
reinterpret_cast<RegisterSingletonType *>(data),
1013 singletonInstanceInfo(*
reinterpret_cast<RegisterSingletonType *>(data))));
1014 case CompositeRegistration:
1015 return finalizeType(QQmlMetaType::registerCompositeType(
1016 *
reinterpret_cast<RegisterCompositeType *>(data)));
1017 case CompositeSingletonRegistration:
1018 return finalizeType(QQmlMetaType::registerCompositeSingletonType(
1019 *
reinterpret_cast<RegisterCompositeSingletonType *>(data),
1020 singletonInstanceInfo(*
reinterpret_cast<RegisterCompositeSingletonType *>(data))));
1021 case SequentialContainerRegistration:
1022 return finalizeType(QQmlMetaType::registerSequentialContainer(
1023 *
reinterpret_cast<RegisterSequentialContainer *>(data)));
1031void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data)
1034 case AutoParentRegistration:
1035 QQmlMetaType::unregisterAutoParentFunction(
reinterpret_cast<AutoParentFunction>(data));
1037 case QmlUnitCacheHookRegistration:
1038 QQmlMetaType::removeCachedUnitLookupFunction(
1039 reinterpret_cast<QmlUnitCacheLookupFunction>(data));
1041 case SequentialContainerRegistration:
1042 QQmlMetaType::unregisterSequentialContainer(data);
1044 case TypeRegistration:
1045 case InterfaceRegistration:
1046 case SingletonRegistration:
1047 case CompositeRegistration:
1048 case CompositeSingletonRegistration:
1049 QQmlMetaType::unregisterType(data);
1051 case TypeAndRevisionsRegistration:
1052 case SingletonAndRevisionsRegistration:
1053 case SequentialContainerAndRevisionsRegistration:
1063QList<QTypeRevision> QQmlPrivate::revisionClassInfos(
const QMetaObject *metaObject,
1066 QList<QTypeRevision> revisions;
1067 for (
int index = indexOfOwnClassInfo(metaObject, key); index != -1;
1068 index = indexOfOwnClassInfo(metaObject, key, index - 1)) {
1069 revisions.push_back(QTypeRevision::fromEncodedVersion(
1070 QLatin1StringView(metaObject->classInfo(index).value()).toInt()));
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
1106
1107
1108
1109int qmlRegisterTypeNotAvailable(
1110 const char *uri,
int versionMajor,
int versionMinor,
1111 const char *qmlName,
const QString &message)
1114 uri, versionMajor, versionMinor, qmlName, message);
1120 const char *uri,
int versionMajor,
const QMetaObject *classInfoMetaObject,
1121 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
bool)
1125 RegisterTypeAndRevisions type = {
1127 QmlMetaType<T>::self(),
1128 QmlMetaType<T>::list(),
1135 QTypeRevision::fromMajorVersion(versionMajor),
1137 &QQmlTypeNotAvailable::staticMetaObject,
1138 classInfoMetaObject,
1140 attachedPropertiesFunc<T>(),
1141 attachedPropertiesMetaObject<T>(),
1143 StaticCastSelector<T, QQmlParserStatus>::cast(),
1144 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1145 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1149 qmlCreateCustomParser<T>,
1151 QQmlPrivate::StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1153 QmlMetaType<T>::sequence(),
1156 qmlregister(TypeAndRevisionsRegistration, &type);
1174 QQmlEngine *engine = aotContext->qmlEngine();
1175 return engine ? QQmlEnginePrivate::get(aotContext->qmlEngine())->propertyCapture :
nullptr;
1208static bool markPointer(
const QVariant &element, QV4::MarkStack *markStack)
1210 if (!element.metaType().flags().testFlag(QMetaType::PointerToQObject))
1213 QV4::QObjectWrapper::markWrapper(
1214 *
static_cast<QObject *
const *>(element.constData()), markStack);
1220#define ADD_CASE(Type, id, T)
1221 case QMetaType::Type:
1223 const QMetaType elementMetaType = element.metaType();
1224 switch (elementMetaType.id()) {
1225 case QMetaType::QVariantMap:
1226 for (
const QVariant &variant : *
static_cast<
const QVariantMap *>(element.constData()))
1227 elements->push_back(variant);
1229 case QMetaType::QVariantHash:
1230 for (
const QVariant &variant : *
static_cast<
const QVariantHash *>(element.constData()))
1231 elements->push_back(variant);
1233 case QMetaType::QVariantList:
1234 for (
const QVariant &variant : *
static_cast<
const QVariantList *>(element.constData()))
1235 elements->push_back(variant);
1237 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1238 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1239 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1240 case QMetaType::QStringList:
1241 case QMetaType::QByteArrayList:
1247 if (elementMetaType == QMetaType::fromType<QJSValue>()
1248 || elementMetaType == QMetaType::fromType<QJSManagedValue>()
1249 || elementMetaType == QMetaType::fromType<QJSPrimitiveValue>()) {
1255 QMetaSequence::Iterable iterable;
1256 if (!QMetaType::convert(
1257 element.metaType(), element.constData(),
1258 QMetaType::fromType<QMetaSequence::Iterable>(), &iterable)) {
1262 switch (iterable.metaContainer().valueMetaType().id()) {
1263 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1264 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1265 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1266 case QMetaType::QStringList:
1267 case QMetaType::QByteArrayList:
1273 for (
auto it = iterable.constBegin(), end = iterable.constEnd(); it != end; ++it)
1274 elements->push_back(*it);
1317static bool inherits(
const QQmlPropertyCache *descendent,
const QQmlPropertyCache *ancestor)
1319 for (
const QQmlPropertyCache *cache = descendent; cache; cache = cache->parent().data()) {
1320 if (cache == ancestor)
1419 void *
a[] = {
target,
nullptr };
1431 void *
a[] = {
source,
nullptr };
1523template<
typename Op>
1553 void *
args[] = {
nullptr };
1572 const bool isUnsigned = enumType.flags() & QMetaType::IsUnsignedEnumeration;
1573 switch (enumType.sizeOf()) {
1576 ? numberType == QMetaType::fromType<quint8>()
1577 : numberType == QMetaType::fromType<qint8>();
1580 ? numberType == QMetaType::fromType<ushort>()
1581 : numberType == QMetaType::fromType<
short>();
1588 ? (numberType == QMetaType::fromType<
int>()
1589 || numberType == QMetaType::fromType<uint>())
1590 : numberType == QMetaType::fromType<
int>();
1593 ? numberType == QMetaType::fromType<qulonglong>()
1594 : numberType == QMetaType::fromType<qlonglong>();
1603 return !type.isValid()
1604 || type == QMetaType::fromType<QVariant>()
1605 || type == QMetaType::fromType<QJSPrimitiveValue>();
1610 if (source == target)
1613 if ((source.flags() & QMetaType::IsQmlList)
1614 && (target.flags() & QMetaType::IsQmlList)) {
1620 if (target.flags() & QMetaType::PointerToQObject) {
1623 const QMetaObject *targetMetaObject = target.metaObject();
1624 const QMetaObject *sourceMetaObject = source.metaObject();
1625 if (!sourceMetaObject)
1626 sourceMetaObject = QQmlMetaType::metaObjectForType(source).metaObject();
1628 while (sourceMetaObject && sourceMetaObject != targetMetaObject)
1629 sourceMetaObject = sourceMetaObject->superClass();
1631 return sourceMetaObject !=
nullptr;
1634 if (target.flags() & QMetaType::IsEnumeration)
1635 return isEnumUnderlyingType(target, source);
1637 if (source.flags() & QMetaType::IsEnumeration)
1638 return isEnumUnderlyingType(source, target);
1640 if (!source.isValid())
1641 return canHoldVoid(target);
1712template<QV4::Lookup::Call FallbackCall>
1714 const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
1716 QV4::Scope scope(aotContext->engine->handle());
1717 QV4::PropertyKey id = scope.engine->identifierTable->asPropertyKey(
1718 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]);
1720 Q_ASSERT(id.isString());
1722 QV4::ScopedString name(scope, id.asStringOrSymbol());
1724 Q_ASSERT(!name->equals(scope.engine->id_toString()));
1725 Q_ASSERT(!name->equals(scope.engine->id_destroy()));
1727 QQmlData *ddata = QQmlData::get(object,
true);
1729 if (ddata->isQueuedForDeletion)
1732 const QQmlPropertyData *property;
1733 if (!ddata->propertyCache) {
1734 property = QQmlPropertyCache::property(object, name, aotContext->qmlContext,
nullptr);
1736 property = ddata->propertyCache->property(
1737 name.getPointer(), object, aotContext->qmlContext);
1741 const QMetaObject *metaObject = object->metaObject();
1745 const int coreIndex = metaObject->indexOfProperty(
1746 name->toQStringNoThrow().toUtf8().constData());
1750 const QMetaProperty property = metaObject->property(coreIndex);
1752 lookup->releasePropertyCache();
1754 lookup->qobjectFallbackLookup.metaObject = quintptr(metaObject) + 1;
1755 lookup->qobjectFallbackLookup.metaType = quintptr(property.metaType().iface()) + 1;
1756 lookup->qobjectFallbackLookup.coreIndex = coreIndex;
1757 lookup->qobjectFallbackLookup.notifyIndex =
1758 QMetaObjectPrivate::signalIndex(property.notifySignal());
1760 if constexpr (FallbackCall == QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback
1761 || FallbackCall == QV4::Lookup::Call::GetterQObjectPropertyFallback) {
1762 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isConstant() ? 1 : 0;
1763 }
else if constexpr (FallbackCall == QV4::Lookup::Call::SetterQObjectPropertyFallback) {
1764 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isResettable() ? 1 : 0;
1769 Q_ASSERT(ddata->propertyCache);
1771 QV4::setupQObjectLookup(lookup, ddata, property);
1777template<QV4::Lookup::Call ObjectCall, QV4::Lookup::Call FallbackCall,
LookupType Type>
1780 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
1781 if (v4->hasException) {
1782 v4->amendException();
1786 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
1787 switch (initObjectLookup<FallbackCall>(aotContext, lookup, object)) {
1789 lookup->call = ObjectCall;
1793 lookup->call = FallbackCall;
1797 v4->throwTypeError();
1806 QV4::Lookup *lookup, QV4::ExecutableCompilationUnit *compilationUnit,
1807 const QMetaObject *metaObject)
1809 Q_ASSERT(metaObject);
1810 const QByteArray name = compilationUnit->runtimeStrings[lookup->nameIndex]->toQString().toUtf8();
1811 const int coreIndex = metaObject->indexOfProperty(name.constData());
1812 QMetaType lookupType = metaObject->property(coreIndex).metaType();
1813 lookup->qgadgetLookup.metaObject = quintptr(metaObject) + 1;
1814 lookup->qgadgetLookup.coreIndex = coreIndex;
1815 lookup->qgadgetLookup.metaType = lookupType.iface();
1879#if QT_CONFIG(translation)
1929 if (type == QMetaType::fromType<QVariant>())
1930 return !
static_cast<
const QVariant *>(value)->isValid();
1931 if (type == QMetaType::fromType<QJSValue>())
1932 return static_cast<
const QJSValue *>(value)->isUndefined();
1933 if (type == QMetaType::fromType<QJSPrimitiveValue>()) {
1934 return static_cast<
const QJSPrimitiveValue *>(value)->type()
1935 == QJSPrimitiveValue::Undefined;
2034 QStringLiteral(
"Value is null and could not be converted to an object"));
2060 QStringLiteral(
"A QmlLoggingCatgory was provided without a valid name"));
2128 const QQmlType &type,
const QV4::CompiledData::ParameterType ¶meter)
2130 return parameter.isList() ? type.qListTypeId() : type.typeId();
2179 for (
int i = 0;
i <
argc; ++
i)
2252 const AOTCompiledContext *aotContext, QV4::Lookup *lookup,
const QString &object)
2254 aotContext->engine->handle()->throwTypeError(
2255 QStringLiteral(
"Property '%1' of object %2 is not a function").arg(
2256 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString(),
2286 QV4::QObjectMethod *method, QV4::Lookup *lookup,
int relativeMethodIndex)
2288 Q_ASSERT(lookup->qobjectMethodLookup.method.get() == method->d());
2290 const auto *d = method->d();
2291 const int methodCount = d->methodCount;
2293 if (relativeMethodIndex == -1 && methodCount == 1) {
2297 Q_ASSERT(d->methods[0].metaMethod().methodType() == QMetaMethod::Signal);
2298 lookup->qobjectMethodLookup.propertyData = d->methods;
2302 for (
int i = 0, end = d->methodCount; i != end; ++i) {
2303 const QMetaMethod metaMethod = d->methods[i].metaMethod();
2304 if (metaMethod.relativeMethodIndex() != relativeMethodIndex)
2307 lookup->qobjectMethodLookup.propertyData = d->methods + i;
2661template<QV4::Lookup::Call call>
2662static void initTypeWrapperLookup(
2663 const AOTCompiledContext *context, QV4::Lookup *lookup, uint importNamespace)
2665 Q_ASSERT(!context->engine->hasError());
2666 if (importNamespace != AOTCompiledContext::InvalidStringId) {
2667 QV4::Scope scope(context->engine->handle());
2668 QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]);
2670 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2671 Q_ASSERT(typeLoader);
2672 if (
const QQmlImportRef *importRef
2673 = context->qmlContext->imports()->query(import, typeLoader).importNamespace) {
2675 QV4::Scoped<QV4::QQmlTypeWrapper> wrapper(
2676 scope, QV4::QQmlTypeWrapper::create(
2677 scope.engine,
nullptr, context->qmlContext->imports(), importRef));
2680 wrapper = lookup->getter(context->engine->handle(), wrapper);
2683 lookup->releasePropertyCache();
2685 lookup->call = call;
2687 case QV4::Lookup::Call::ContextGetterSingleton:
2688 lookup->qmlContextSingletonLookup.singletonObject.set(scope.engine, wrapper->heapObject());
2690 case QV4::Lookup::Call::ContextGetterType:
2691 lookup->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->heapObject());
2698 scope.engine->throwTypeError();
2700 QV4::ExecutionEngine *v4 = context->engine->handle();
2701 lookup->contextGetter(v4,
nullptr);
2702 if (lookup->call != call) {
2704 = QLatin1String(call == QV4::Lookup::Call::ContextGetterSingleton
2705 ?
"%1 was a singleton at compile time, "
2706 "but is not a singleton anymore."
2707 :
"%1 was not a singleton at compile time, "
2708 "but is a singleton now.")
2709 .arg(context->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString());
2710 v4->throwTypeError(error);
2990 QStringLiteral(
"Value is null and could not be converted to an object"));
3044 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target,
void *value)
3046 void *args[] = { value,
nullptr };
3047 metaObject->d.static_metacall(
3048 reinterpret_cast<QObject *>(target), QMetaObject::WriteProperty,
3049 lookup->qgadgetLookup.coreIndex, args);
3054 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target, QV4::ExecutionEngine *v4)
3056 const QMetaProperty property = metaObject->property(lookup->qgadgetLookup.coreIndex);
3057 if (property.isResettable()) {
3058 void *args[] = {
nullptr };
3059 metaObject->d.static_metacall(
3060 reinterpret_cast<QObject *>(target), QMetaObject::ResetProperty,
3061 lookup->qgadgetLookup.coreIndex, args);
3064 QLatin1String(
"Cannot assign [undefined] to ") +
3065 QLatin1String(property.metaType().name()));
3072 QV4::ExecutionEngine *v4, QV4::Lookup *lookup,
const QMetaObject *metaObject,
3073 void *target,
void *value)
3075 QVariant *variant =
static_cast<QVariant *>(value);
3076 const QMetaType propType = metaObject->property(lookup->qgadgetLookup.coreIndex).metaType();
3077 if (propType == QMetaType::fromType<QVariant>())
3078 return storeValueProperty(lookup, metaObject, target, variant);
3080 if (!variant->isValid())
3081 return resetValueProperty(lookup, metaObject, target, v4);
3083 if (isTypeCompatible(variant->metaType(), propType))
3084 return storeValueProperty(lookup, metaObject, target, variant->data());
3086 QVariant converted(propType);
3087 QV4::Scope scope(v4);
3088 QV4::ScopedValue val(scope, v4->fromVariant(*variant));
3089 if (v4->metaTypeFromJS(val, propType, converted.data())
3090 || QMetaType::convert(
3091 variant->metaType(), variant->constData(), propType, converted.data())) {
3092 return storeValueProperty(lookup, metaObject, target, converted.data());
3096 QLatin1String(
"Cannot assign ") + QLatin1String(variant->metaType().name())
3097 + QLatin1String(
" to ") + QLatin1String(propType.name()));
3129void initValueLookup(
3130 const AOTCompiledContext *aotContext, uint index,
const QMetaObject *metaObject)
3132 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
3133 if (v4->hasException) {
3134 v4->amendException();
3138 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
3139 initValueLookup(lookup, aotContext->compilationUnit, metaObject);
3140 lookup->call = QV4::Lookup::Call::SetterValueTypeProperty;
3202
3203
3204
3205
3206
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
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
3265
3266
3267
3268
3269
3270
3271
3272
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
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
3439
3440
3441
3442
3443
3444
3445
3446
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
3474
3475
3476
3477
3478
3479
3480
3481
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
3533
3534
3535
3536
3537
3538
3539
3540
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
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
3650
3651
3652
3653
3654
3655
3656
3657
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
3698
3699
3700
3701
3702
3703
3704
3705
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
3794
3795
3796
3797
3798
3799
3800
3801
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
PropertyResult loadFallbackAsVariant(QV4::Lookup *lookup, QObject *object, void *target, const AOTCompiledContext *aotContext)
static ObjectLookupResult initObjectLookup(const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
void qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *extension, bool)
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 void throwIsNotAFunctionError(const AOTCompiledContext *aotContext, QV4::Lookup *lookup, const QString &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 changeObjectProperty(QV4::Lookup *lookup, QObject *object, Op op)
static PropertyResult storeObjectProperty(QV4::Lookup *lookup, 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 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 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 PropertyResult storeFallbackProperty(QV4::Lookup *lookup, QObject *object, void *value)
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 PropertyResult resetFallbackProperty(QV4::Lookup *lookup, QObject *object, QV4::ExecutionEngine *v4)
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 resetObjectProperty(QV4::Lookup *lookup, QObject *object, QV4::ExecutionEngine *v4)
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)
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)
Combined button and popup list for selecting options.
QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *object, const QMetaObject *attachedMetaObject)
static QList< QTypeRevision > availableRevisions(const QMetaObject *metaObject)
static void doRegisterSingletonAndRevisions(const QQmlPrivate::RegisterSingletonTypeAndRevisions &type, const ElementNames &elementNames)
static ElementNames classElementNames(const QMetaObject *metaObject)
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool createIfMissing)
static void uniqueRevisions(QList< QTypeRevision > *revisions, QTypeRevision defaultVersion, QTypeRevision added)
void assignVersions(Registration *registration, QTypeRevision revision, QTypeRevision defaultVersion)
static int finalizeType(const QQmlType &dtype)
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
static QObject * resolveAttachedProperties(QQmlAttachedPropertiesFunc pf, QQmlData *data, QObject *object, bool create)
QT_BEGIN_NAMESPACE void qmlExecuteDeferred(QObject *object)
\inmodule QtQml \title Functions to register C++ types to QML
static QList< QTypeRevision > prepareRevisions(const QMetaObject *metaObject, QTypeRevision added)
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 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