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
311void qmlClearTypeRegistrations()
313 QQmlMetaType::clearTypeRegistrations();
314 QQmlEnginePrivate::baseModulesUninitialized =
true;
315 qmlClearEnginePlugins();
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
345
348 return QQmlMetaType::protectModule(QString::fromUtf8(uri),
349 QTypeRevision::fromMajorVersion(majVersion));
353
354
355
356
357
358
359
360
361
362
366 QQmlMetaType::registerModule(uri, QTypeRevision::fromVersion(versionMajor, versionMinor));
371 if (importMajor == QQmlModuleImportAuto)
372 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Auto);
373 else if (importMajor == QQmlModuleImportLatest)
374 return QQmlDirParser::Import(uri, QTypeRevision(), QQmlDirParser::Import::Default);
375 else if (importMinor == QQmlModuleImportLatest)
376 return QQmlDirParser::Import(uri, QTypeRevision::fromMajorVersion(importMajor), QQmlDirParser::Import::Default);
377 return QQmlDirParser::Import(uri, QTypeRevision::fromVersion(importMajor, importMinor), QQmlDirParser::Import::Default);
382 return moduleMajor == QQmlModuleImportModuleAny
384 : QTypeRevision::fromMajorVersion(moduleMajor);
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
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
446
448 const char *import,
int importMajor,
int importMinor)
450 QQmlMetaType::registerModuleImport(
451 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
452 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
457
458
459
460
461
462
463
464
465
466
468 const char *import,
int importMajor,
int importMinor)
470 QQmlMetaType::unregisterModuleImport(
471 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
472 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499int qmlTypeId(
const char *uri,
int versionMajor,
int versionMinor,
const char *qmlName)
501 auto revision = QTypeRevision::fromVersion(versionMajor, versionMinor);
502 int id = QQmlMetaType::typeId(uri, revision, qmlName);
506
507
508
509
510
512 QQmlTypeLoader *typeLoader = QQmlTypeLoader::get(&engine);
513 auto loadHelper = QQml::makeRefPointer<LoadHelper>(
514 typeLoader, uri, qmlName, QQmlTypeLoader::Synchronous);
515 const QQmlType type = loadHelper->type();
516 if (type.availableInVersion(revision))
526 error.setDescription(QStringLiteral(
"The registered singleton has already been deleted. "
527 "Ensure that it outlives the engine."));
528 QQmlEnginePrivate::get(engine)->warning(engine, error);
532 if (engine->thread() != instance->thread()) {
534 error.setDescription(QStringLiteral(
"Registered object must live in the same thread "
535 "as the engine it was registered with"));
536 QQmlEnginePrivate::get(engine)->warning(engine, error);
544#if QT_DEPRECATED_SINCE(6
, 3
)
545QObject *QQmlPrivate::SingletonFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
547 if (!checkSingletonInstance(qeng, m_object))
552 error.setDescription(QStringLiteral(
"Singleton registered by registerSingletonInstance "
553 "must only be accessed from one engine"));
554 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
558 alreadyCalled =
true;
559 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
564QObject *QQmlPrivate::SingletonInstanceFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
566 if (!checkSingletonInstance(qeng, m_object))
571 QJSEngine::setObjectOwnership(m_object, QQmlEngine::CppOwnership);
572 }
else if (m_engine != qeng) {
574 error.setDescription(QLatin1String(
"Singleton registered by registerSingletonInstance must only be accessed from one engine"));
575 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
584 QList<QTypeRevision> revisions;
587 const int propertyOffset = metaObject->propertyOffset();
588 const int propertyCount = metaObject->propertyCount();
589 for (
int coreIndex = propertyOffset, propertyEnd = propertyOffset + propertyCount;
590 coreIndex < propertyEnd; ++coreIndex) {
591 const QMetaProperty property = metaObject->property(coreIndex);
592 if (
int revision = property.revision())
593 revisions.append(QTypeRevision::fromEncodedVersion(revision));
595 const int methodOffset = metaObject->methodOffset();
596 const int methodCount = metaObject->methodCount();
597 for (
int methodIndex = methodOffset, methodEnd = methodOffset + methodCount;
598 methodIndex < methodEnd; ++methodIndex) {
599 const QMetaMethod method = metaObject->method(methodIndex);
600 if (
int revision = method.revision())
601 revisions.append(QTypeRevision::fromEncodedVersion(revision));
605 if (
const QMetaObject *superMeta = metaObject->superClass())
606 revisions += availableRevisions(superMeta);
611template<
typename Registration>
613 QTypeRevision defaultVersion)
615 const quint8 majorVersion = revision.hasMajorVersion() ? revision.majorVersion()
616 : defaultVersion.majorVersion();
617 registration->version = revision.hasMinorVersion()
618 ? QTypeRevision::fromVersion(majorVersion, revision.minorVersion())
619 : QTypeRevision::fromMajorVersion(majorVersion);
620 registration->revision = revision;
625 auto revisions = availableRevisions(metaObject);
626 revisions.append(added);
630static void uniqueRevisions(QList<QTypeRevision> *revisions, QTypeRevision defaultVersion,
633 bool revisionsHaveMajorVersions =
false;
634 for (QTypeRevision revision : QList<QTypeRevision>(*revisions)) {
636 if (revision.hasMajorVersion()) {
637 revisionsHaveMajorVersions =
true;
638 if (revision.majorVersion() < defaultVersion.majorVersion())
639 revisions->append(QTypeRevision::fromVersion(revision.majorVersion(), 254));
643 if (revisionsHaveMajorVersions) {
644 if (!added.hasMajorVersion()) {
646 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(),
647 added.minorVersion()));
648 }
else if (added.majorVersion() < defaultVersion.majorVersion()) {
650 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(), 0));
654 std::sort(revisions->begin(), revisions->end());
655 const auto it = std::unique(revisions->begin(), revisions->end());
656 revisions->erase(it, revisions->end());
660 const QQmlPrivate::RegisterSingletonType &type)
662 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
663 siinfo->scriptCallback = type.scriptApi;
664 siinfo->qobjectCallback = type.qObjectApi;
665 siinfo->typeName = type.typeName;
666 return QQmlType::SingletonInstanceInfo::ConstPtr(
667 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
671 const QQmlPrivate::RegisterCompositeSingletonType &type)
673 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
674 siinfo->url = QQmlMetaType::normalizedUrl(type.url);
675 siinfo->typeName = type.typeName;
676 return QQmlType::SingletonInstanceInfo::ConstPtr(
677 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
682 if (!dtype.isValid())
685 QQmlMetaType::registerUndeletableType(dtype);
686 return dtype.index();
689using ElementNames = QVarLengthArray<
const char *, 8>;
692 Q_ASSERT(metaObject);
693 const char *key =
"QML.Element";
695 const int offset = metaObject->classInfoOffset();
696 const int start = metaObject->classInfoCount() + offset - 1;
698 ElementNames elementNames;
700 for (
int i = start; i >= offset; --i) {
701 const QMetaClassInfo classInfo = metaObject->classInfo(i);
702 if (qstrcmp(key, classInfo.name()) == 0) {
703 const char *elementName = classInfo.value();
705 if (qstrcmp(elementName,
"auto") == 0) {
706 const char *strippedClassName = metaObject->className();
707 for (
const char *c = strippedClassName; *c !=
'\0'; c++) {
709 strippedClassName = c + 1;
711 elementName = strippedClassName;
712 }
else if (qstrcmp(elementName,
"anonymous") == 0) {
713 if (elementNames.isEmpty())
714 elementNames.push_back(
nullptr);
715 else if (elementNames[0] !=
nullptr)
716 qWarning() << metaObject->className() <<
"is both anonymous and named";
720 if (!elementNames.isEmpty() && elementNames[0] ==
nullptr) {
721 qWarning() << metaObject->className() <<
"is both anonymous and named";
722 elementNames[0] = elementName;
724 elementNames.push_back(elementName);
739 for (
int i = 1, end = elementNames->length(); i < end; ++i)
740 otherNames.append(QString::fromUtf8(elementNames->at(i)));
741 elementNames =
nullptr;
744 for (
const QString &otherName : std::as_const(otherNames))
745 QQmlMetaType::registerTypeAlias(typeId, otherName);
749 const ElementNames *elementNames;
750 QVarLengthArray<QString, 8> otherNames;
755 const QQmlPrivate::RegisterTypeAndRevisions &type,
756 const ElementNames &elementNames)
758 using namespace QQmlPrivate;
760 const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
761 const bool creatable = (elementNames[0] !=
nullptr || isValueType)
762 && boolClassInfo(type.classInfoMetaObject,
"QML.Creatable",
true);
764 QString noCreateReason;
765 ValueTypeCreationMethod creationMethod = ValueTypeCreationMethod::None;
768 noCreateReason = QString::fromUtf8(
769 classInfo(type.classInfoMetaObject,
"QML.UncreatableReason"));
770 if (noCreateReason.isEmpty())
771 noCreateReason = QLatin1String(
"Type cannot be created in QML.");
772 }
else if (isValueType) {
773 const char *method = classInfo(type.classInfoMetaObject,
"QML.CreationMethod");
774 if (qstrcmp(method,
"structured") == 0)
775 creationMethod = ValueTypeCreationMethod::Structured;
776 else if (qstrcmp(method,
"construct") == 0)
777 creationMethod = ValueTypeCreationMethod::Construct;
780 RegisterType typeRevision = {
781 QQmlPrivate::RegisterType::CurrentVersion,
784 creatable ? type.objectSize : 0,
788 type.createValueType,
793 type.attachedPropertiesFunction,
794 type.attachedPropertiesMetaObject,
795 type.parserStatusCast,
796 type.valueSourceCast,
797 type.valueInterceptorCast,
798 type.extensionObjectCreate,
799 type.extensionMetaObject,
802 type.structVersion > 0 ? type.finalizerCast : -1,
806 QQmlPrivate::RegisterSequentialContainer sequenceRevision = {
812 type.structVersion > 1 ? type.listMetaSequence : QMetaSequence(),
816 const QTypeRevision added = revisionClassInfo(
817 type.classInfoMetaObject,
"QML.AddedInVersion",
818 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
819 const QTypeRevision removed = revisionClassInfo(
820 type.classInfoMetaObject,
"QML.RemovedInVersion");
821 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
824 auto revisions = prepareRevisions(type.metaObject, added) + furtherRevisions;
825 if (type.attachedPropertiesMetaObject)
826 revisions += availableRevisions(type.attachedPropertiesMetaObject);
827 uniqueRevisions(&revisions, type.version, added);
830 for (QTypeRevision revision : std::as_const(revisions)) {
831 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
834 assignVersions(&typeRevision, revision, type.version);
837 if (typeRevision.version < added
838 || (removed.isValid() && !(typeRevision.version < removed))) {
839 typeRevision.elementName =
nullptr;
840 typeRevision.create =
nullptr;
841 typeRevision.userdata =
nullptr;
843 typeRevision.elementName = elementNames[0];
844 typeRevision.create = creatable ? type.create :
nullptr;
845 typeRevision.userdata = type.userdata;
848 typeRevision.customParser = type.customParserFactory();
849 const int id = qmlregister(TypeRegistration, &typeRevision);
851 type.qmlTypeIds->append(id);
853 if (typeRevision.elementName)
854 aliasRegistrar.registerAliases(id);
856 if (sequenceRevision.metaSequence != QMetaSequence()) {
857 sequenceRevision.version = typeRevision.version;
858 sequenceRevision.revision = typeRevision.revision;
859 const int id = QQmlPrivate::qmlregister(
860 QQmlPrivate::SequentialContainerRegistration, &sequenceRevision);
862 type.qmlTypeIds->append(id);
868 const QQmlPrivate::RegisterSingletonTypeAndRevisions &type,
869 const ElementNames &elementNames)
871 using namespace QQmlPrivate;
873 RegisterSingletonType revisionRegistration = {
880 type.instanceMetaObject,
882 type.extensionObjectCreate,
883 type.extensionMetaObject,
886 const QQmlType::SingletonInstanceInfo::ConstPtr siinfo
887 = singletonInstanceInfo(revisionRegistration);
889 const QTypeRevision added = revisionClassInfo(
890 type.classInfoMetaObject,
"QML.AddedInVersion",
891 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
892 const QTypeRevision removed = revisionClassInfo(
893 type.classInfoMetaObject,
"QML.RemovedInVersion");
894 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
897 auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions;
898 uniqueRevisions(&revisions, type.version, added);
901 for (QTypeRevision revision : std::as_const(revisions)) {
902 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
905 assignVersions(&revisionRegistration, revision, type.version);
908 if (revisionRegistration.version < added
909 || (removed.isValid() && !(revisionRegistration.version < removed))) {
910 revisionRegistration.typeName =
nullptr;
911 revisionRegistration.qObjectApi =
nullptr;
913 revisionRegistration.typeName = elementNames[0];
914 revisionRegistration.qObjectApi = type.qObjectApi;
917 const int id = finalizeType(
918 QQmlMetaType::registerSingletonType(revisionRegistration, siinfo));
920 type.qmlTypeIds->append(id);
922 if (revisionRegistration.typeName)
923 aliasRegistrar.registerAliases(id);
928
929
930
931int QQmlPrivate::qmlregister(RegistrationType type,
void *data)
934 case AutoParentRegistration:
935 return QQmlMetaType::registerAutoParentFunction(
936 *
reinterpret_cast<RegisterAutoParent *>(data));
937 case QmlUnitCacheHookRegistration:
938 return QQmlMetaType::registerUnitCacheHook(
939 *
reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
940 case TypeAndRevisionsRegistration: {
941 const RegisterTypeAndRevisions &type = *
reinterpret_cast<RegisterTypeAndRevisions *>(data);
942 if (type.structVersion > 1 && type.forceAnonymous) {
943 doRegisterTypeAndRevisions(type, {
nullptr});
945 const ElementNames names = classElementNames(type.classInfoMetaObject);
946 if (names.isEmpty()) {
947 qWarning().nospace() <<
"Missing QML.Element class info for "
948 << type.classInfoMetaObject->className();
950 doRegisterTypeAndRevisions(type, names);
956 case SingletonAndRevisionsRegistration: {
957 const RegisterSingletonTypeAndRevisions &type
958 = *
reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data);
959 const ElementNames names = classElementNames(type.classInfoMetaObject);
960 if (names.isEmpty()) {
961 qWarning().nospace() <<
"Missing QML.Element class info for "
962 << type.classInfoMetaObject->className();
964 doRegisterSingletonAndRevisions(type, names);
968 case SequentialContainerAndRevisionsRegistration: {
969 const RegisterSequentialContainerAndRevisions &type
970 = *
reinterpret_cast<RegisterSequentialContainerAndRevisions *>(data);
971 RegisterSequentialContainer revisionRegistration = {
981 const QTypeRevision added = revisionClassInfo(
982 type.classInfoMetaObject,
"QML.AddedInVersion",
983 QTypeRevision::fromMinorVersion(0));
984 QList<QTypeRevision> revisions = revisionClassInfos(
985 type.classInfoMetaObject,
"QML.ExtraVersion");
986 revisions.append(added);
987 uniqueRevisions(&revisions, type.version, added);
989 for (QTypeRevision revision : std::as_const(revisions)) {
990 if (revision < added)
992 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
995 assignVersions(&revisionRegistration, revision, type.version);
996 const int id = qmlregister(SequentialContainerRegistration, &revisionRegistration);
998 type.qmlTypeIds->append(id);
1002 case TypeRegistration:
1003 return finalizeType(
1004 QQmlMetaType::registerType(*
reinterpret_cast<RegisterType *>(data)));
1005 case InterfaceRegistration:
1006 return finalizeType(
1007 QQmlMetaType::registerInterface(*
reinterpret_cast<RegisterInterface *>(data)));
1008 case SingletonRegistration:
1009 return finalizeType(QQmlMetaType::registerSingletonType(
1010 *
reinterpret_cast<RegisterSingletonType *>(data),
1011 singletonInstanceInfo(*
reinterpret_cast<RegisterSingletonType *>(data))));
1012 case CompositeRegistration:
1013 return finalizeType(QQmlMetaType::registerCompositeType(
1014 *
reinterpret_cast<RegisterCompositeType *>(data)));
1015 case CompositeSingletonRegistration:
1016 return finalizeType(QQmlMetaType::registerCompositeSingletonType(
1017 *
reinterpret_cast<RegisterCompositeSingletonType *>(data),
1018 singletonInstanceInfo(*
reinterpret_cast<RegisterCompositeSingletonType *>(data))));
1019 case SequentialContainerRegistration:
1020 return finalizeType(QQmlMetaType::registerSequentialContainer(
1021 *
reinterpret_cast<RegisterSequentialContainer *>(data)));
1029void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data)
1032 case AutoParentRegistration:
1033 QQmlMetaType::unregisterAutoParentFunction(
reinterpret_cast<AutoParentFunction>(data));
1035 case QmlUnitCacheHookRegistration:
1036 QQmlMetaType::removeCachedUnitLookupFunction(
1037 reinterpret_cast<QmlUnitCacheLookupFunction>(data));
1039 case SequentialContainerRegistration:
1040 QQmlMetaType::unregisterSequentialContainer(data);
1042 case TypeRegistration:
1043 case InterfaceRegistration:
1044 case SingletonRegistration:
1045 case CompositeRegistration:
1046 case CompositeSingletonRegistration:
1047 QQmlMetaType::unregisterType(data);
1049 case TypeAndRevisionsRegistration:
1050 case SingletonAndRevisionsRegistration:
1051 case SequentialContainerAndRevisionsRegistration:
1061QList<QTypeRevision> QQmlPrivate::revisionClassInfos(
const QMetaObject *metaObject,
1064 QList<QTypeRevision> revisions;
1065 for (
int index = indexOfOwnClassInfo(metaObject, key); index != -1;
1066 index = indexOfOwnClassInfo(metaObject, key, index - 1)) {
1067 revisions.push_back(QTypeRevision::fromEncodedVersion(
1068 QLatin1StringView(metaObject->classInfo(index).value()).toInt()));
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
1106
1107int qmlRegisterTypeNotAvailable(
1108 const char *uri,
int versionMajor,
int versionMinor,
1109 const char *qmlName,
const QString &message)
1112 uri, versionMajor, versionMinor, qmlName, message);
1118 const char *uri,
int versionMajor,
const QMetaObject *classInfoMetaObject,
1119 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
bool)
1123 RegisterTypeAndRevisions type = {
1125 QmlMetaType<T>::self(),
1126 QmlMetaType<T>::list(),
1133 QTypeRevision::fromMajorVersion(versionMajor),
1135 &QQmlTypeNotAvailable::staticMetaObject,
1136 classInfoMetaObject,
1138 attachedPropertiesFunc<T>(),
1139 attachedPropertiesMetaObject<T>(),
1141 StaticCastSelector<T, QQmlParserStatus>::cast(),
1142 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1143 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1147 qmlCreateCustomParser<T>,
1149 QQmlPrivate::StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1151 QmlMetaType<T>::sequence(),
1154 qmlregister(TypeAndRevisionsRegistration, &type);
1172 QQmlEngine *engine = aotContext->qmlEngine();
1173 return engine ? QQmlEnginePrivate::get(aotContext->qmlEngine())->propertyCapture :
nullptr;
1206static bool markPointer(
const QVariant &element, QV4::MarkStack *markStack)
1208 if (!element.metaType().flags().testFlag(QMetaType::PointerToQObject))
1211 QV4::QObjectWrapper::markWrapper(
1212 *
static_cast<QObject *
const *>(element.constData()), markStack);
1218#define ADD_CASE(Type, id, T)
1219 case QMetaType::Type:
1221 const QMetaType elementMetaType = element.metaType();
1222 switch (elementMetaType.id()) {
1223 case QMetaType::QVariantMap:
1224 for (
const QVariant &variant : *
static_cast<
const QVariantMap *>(element.constData()))
1225 elements->push_back(variant);
1227 case QMetaType::QVariantHash:
1228 for (
const QVariant &variant : *
static_cast<
const QVariantHash *>(element.constData()))
1229 elements->push_back(variant);
1231 case QMetaType::QVariantList:
1232 for (
const QVariant &variant : *
static_cast<
const QVariantList *>(element.constData()))
1233 elements->push_back(variant);
1235 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1236 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1237 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1238 case QMetaType::QStringList:
1239 case QMetaType::QByteArrayList:
1245 if (elementMetaType == QMetaType::fromType<QJSValue>()
1246 || elementMetaType == QMetaType::fromType<QJSManagedValue>()
1247 || elementMetaType == QMetaType::fromType<QJSPrimitiveValue>()) {
1253 QMetaSequence::Iterable iterable;
1254 if (!QMetaType::convert(
1255 element.metaType(), element.constData(),
1256 QMetaType::fromType<QMetaSequence::Iterable>(), &iterable)) {
1260 switch (iterable.metaContainer().valueMetaType().id()) {
1261 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1262 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1263 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1264 case QMetaType::QStringList:
1265 case QMetaType::QByteArrayList:
1271 for (
auto it = iterable.constBegin(), end = iterable.constEnd(); it != end; ++it)
1272 elements->push_back(*it);
1315static bool inherits(
const QQmlPropertyCache *descendent,
const QQmlPropertyCache *ancestor)
1317 for (
const QQmlPropertyCache *cache = descendent; cache; cache = cache->parent().data()) {
1318 if (cache == ancestor)
1417 void *
a[] = {
target,
nullptr };
1429 void *
a[] = {
source,
nullptr };
1521template<
typename Op>
1551 void *
args[] = {
nullptr };
1570 const bool isUnsigned = enumType.flags() & QMetaType::IsUnsignedEnumeration;
1571 switch (enumType.sizeOf()) {
1574 ? numberType == QMetaType::fromType<quint8>()
1575 : numberType == QMetaType::fromType<qint8>();
1578 ? numberType == QMetaType::fromType<ushort>()
1579 : numberType == QMetaType::fromType<
short>();
1586 ? (numberType == QMetaType::fromType<
int>()
1587 || numberType == QMetaType::fromType<uint>())
1588 : numberType == QMetaType::fromType<
int>();
1591 ? numberType == QMetaType::fromType<qulonglong>()
1592 : numberType == QMetaType::fromType<qlonglong>();
1601 return !type.isValid()
1602 || type == QMetaType::fromType<QVariant>()
1603 || type == QMetaType::fromType<QJSPrimitiveValue>();
1608 if (source == target)
1611 if ((source.flags() & QMetaType::IsQmlList)
1612 && (target.flags() & QMetaType::IsQmlList)) {
1618 if (target.flags() & QMetaType::PointerToQObject) {
1621 const QMetaObject *targetMetaObject = target.metaObject();
1622 const QMetaObject *sourceMetaObject = source.metaObject();
1623 if (!sourceMetaObject)
1624 sourceMetaObject = QQmlMetaType::metaObjectForType(source).metaObject();
1626 while (sourceMetaObject && sourceMetaObject != targetMetaObject)
1627 sourceMetaObject = sourceMetaObject->superClass();
1629 return sourceMetaObject !=
nullptr;
1632 if (target.flags() & QMetaType::IsEnumeration)
1633 return isEnumUnderlyingType(target, source);
1635 if (source.flags() & QMetaType::IsEnumeration)
1636 return isEnumUnderlyingType(source, target);
1638 if (!source.isValid())
1639 return canHoldVoid(target);
1710template<QV4::Lookup::Call FallbackCall>
1712 const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
1714 QV4::Scope scope(aotContext->engine->handle());
1715 QV4::PropertyKey id = scope.engine->identifierTable->asPropertyKey(
1716 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]);
1718 Q_ASSERT(id.isString());
1720 QV4::ScopedString name(scope, id.asStringOrSymbol());
1722 Q_ASSERT(!name->equals(scope.engine->id_toString()));
1723 Q_ASSERT(!name->equals(scope.engine->id_destroy()));
1725 QQmlData *ddata = QQmlData::get(object,
true);
1727 if (ddata->isQueuedForDeletion)
1730 const QQmlPropertyData *property;
1731 if (!ddata->propertyCache) {
1732 property = QQmlPropertyCache::property(object, name, aotContext->qmlContext,
nullptr);
1734 property = ddata->propertyCache->property(
1735 name.getPointer(), object, aotContext->qmlContext);
1739 const QMetaObject *metaObject = object->metaObject();
1743 const int coreIndex = metaObject->indexOfProperty(
1744 name->toQStringNoThrow().toUtf8().constData());
1748 const QMetaProperty property = metaObject->property(coreIndex);
1750 lookup->releasePropertyCache();
1752 lookup->qobjectFallbackLookup.metaObject = quintptr(metaObject) + 1;
1753 lookup->qobjectFallbackLookup.metaType = quintptr(property.metaType().iface()) + 1;
1754 lookup->qobjectFallbackLookup.coreIndex = coreIndex;
1755 lookup->qobjectFallbackLookup.notifyIndex =
1756 QMetaObjectPrivate::signalIndex(property.notifySignal());
1758 if constexpr (FallbackCall == QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback
1759 || FallbackCall == QV4::Lookup::Call::GetterQObjectPropertyFallback) {
1760 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isConstant() ? 1 : 0;
1761 }
else if constexpr (FallbackCall == QV4::Lookup::Call::SetterQObjectPropertyFallback) {
1762 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isResettable() ? 1 : 0;
1767 Q_ASSERT(ddata->propertyCache);
1769 QV4::setupQObjectLookup(lookup, ddata, property);
1775template<QV4::Lookup::Call ObjectCall, QV4::Lookup::Call FallbackCall,
LookupType Type>
1778 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
1779 if (v4->hasException) {
1780 v4->amendException();
1784 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
1785 switch (initObjectLookup<FallbackCall>(aotContext, lookup, object)) {
1787 lookup->call = ObjectCall;
1791 lookup->call = FallbackCall;
1795 v4->throwTypeError();
1804 QV4::Lookup *lookup, QV4::ExecutableCompilationUnit *compilationUnit,
1805 const QMetaObject *metaObject)
1807 Q_ASSERT(metaObject);
1808 const QByteArray name = compilationUnit->runtimeStrings[lookup->nameIndex]->toQString().toUtf8();
1809 const int coreIndex = metaObject->indexOfProperty(name.constData());
1810 QMetaType lookupType = metaObject->property(coreIndex).metaType();
1811 lookup->qgadgetLookup.metaObject = quintptr(metaObject) + 1;
1812 lookup->qgadgetLookup.coreIndex = coreIndex;
1813 lookup->qgadgetLookup.metaType = lookupType.iface();
1877#if QT_CONFIG(translation)
1927 if (type == QMetaType::fromType<QVariant>())
1928 return !
static_cast<
const QVariant *>(value)->isValid();
1929 if (type == QMetaType::fromType<QJSValue>())
1930 return static_cast<
const QJSValue *>(value)->isUndefined();
1931 if (type == QMetaType::fromType<QJSPrimitiveValue>()) {
1932 return static_cast<
const QJSPrimitiveValue *>(value)->type()
1933 == QJSPrimitiveValue::Undefined;
2032 QStringLiteral(
"Value is null and could not be converted to an object"));
2058 QStringLiteral(
"A QmlLoggingCatgory was provided without a valid name"));
2126 const QQmlType &type,
const QV4::CompiledData::ParameterType ¶meter)
2128 return parameter.isList() ? type.qListTypeId() : type.typeId();
2177 for (
int i = 0;
i <
argc; ++
i)
2250 const AOTCompiledContext *aotContext, QV4::Lookup *lookup,
const QString &object)
2252 aotContext->engine->handle()->throwTypeError(
2253 QStringLiteral(
"Property '%1' of object %2 is not a function").arg(
2254 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString(),
2284 QV4::QObjectMethod *method, QV4::Lookup *lookup,
int relativeMethodIndex)
2286 Q_ASSERT(lookup->qobjectMethodLookup.method.get() == method->d());
2288 const auto *d = method->d();
2289 const int methodCount = d->methodCount;
2291 if (relativeMethodIndex == -1 && methodCount == 1) {
2295 Q_ASSERT(d->methods[0].metaMethod().methodType() == QMetaMethod::Signal);
2296 lookup->qobjectMethodLookup.propertyData = d->methods;
2300 for (
int i = 0, end = d->methodCount; i != end; ++i) {
2301 const QMetaMethod metaMethod = d->methods[i].metaMethod();
2302 if (metaMethod.relativeMethodIndex() != relativeMethodIndex)
2305 lookup->qobjectMethodLookup.propertyData = d->methods + i;
2659template<QV4::Lookup::Call call>
2660static void initTypeWrapperLookup(
2661 const AOTCompiledContext *context, QV4::Lookup *lookup, uint importNamespace)
2663 Q_ASSERT(!context->engine->hasError());
2664 if (importNamespace != AOTCompiledContext::InvalidStringId) {
2665 QV4::Scope scope(context->engine->handle());
2666 QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]);
2668 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2669 Q_ASSERT(typeLoader);
2670 if (
const QQmlImportRef *importRef
2671 = context->qmlContext->imports()->query(import, typeLoader).importNamespace) {
2673 QV4::Scoped<QV4::QQmlTypeWrapper> wrapper(
2674 scope, QV4::QQmlTypeWrapper::create(
2675 scope.engine,
nullptr, context->qmlContext->imports(), importRef));
2678 wrapper = lookup->getter(context->engine->handle(), wrapper);
2681 lookup->releasePropertyCache();
2683 lookup->call = call;
2685 case QV4::Lookup::Call::ContextGetterSingleton:
2686 lookup->qmlContextSingletonLookup.singletonObject.set(scope.engine, wrapper->heapObject());
2688 case QV4::Lookup::Call::ContextGetterType:
2689 lookup->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->heapObject());
2696 scope.engine->throwTypeError();
2698 QV4::ExecutionEngine *v4 = context->engine->handle();
2699 lookup->contextGetter(v4,
nullptr);
2700 if (lookup->call != call) {
2702 = QLatin1String(call == QV4::Lookup::Call::ContextGetterSingleton
2703 ?
"%1 was a singleton at compile time, "
2704 "but is not a singleton anymore."
2705 :
"%1 was not a singleton at compile time, "
2706 "but is a singleton now.")
2707 .arg(context->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString());
2708 v4->throwTypeError(error);
2988 QStringLiteral(
"Value is null and could not be converted to an object"));
3042 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target,
void *value)
3044 void *args[] = { value,
nullptr };
3045 metaObject->d.static_metacall(
3046 reinterpret_cast<QObject *>(target), QMetaObject::WriteProperty,
3047 lookup->qgadgetLookup.coreIndex, args);
3052 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target, QV4::ExecutionEngine *v4)
3054 const QMetaProperty property = metaObject->property(lookup->qgadgetLookup.coreIndex);
3055 if (property.isResettable()) {
3056 void *args[] = {
nullptr };
3057 metaObject->d.static_metacall(
3058 reinterpret_cast<QObject *>(target), QMetaObject::ResetProperty,
3059 lookup->qgadgetLookup.coreIndex, args);
3062 QLatin1String(
"Cannot assign [undefined] to ") +
3063 QLatin1String(property.metaType().name()));
3070 QV4::ExecutionEngine *v4, QV4::Lookup *lookup,
const QMetaObject *metaObject,
3071 void *target,
void *value)
3073 QVariant *variant =
static_cast<QVariant *>(value);
3074 const QMetaType propType = metaObject->property(lookup->qgadgetLookup.coreIndex).metaType();
3075 if (propType == QMetaType::fromType<QVariant>())
3076 return storeValueProperty(lookup, metaObject, target, variant);
3078 if (!variant->isValid())
3079 return resetValueProperty(lookup, metaObject, target, v4);
3081 if (isTypeCompatible(variant->metaType(), propType))
3082 return storeValueProperty(lookup, metaObject, target, variant->data());
3084 QVariant converted(propType);
3085 QV4::Scope scope(v4);
3086 QV4::ScopedValue val(scope, v4->fromVariant(*variant));
3087 if (v4->metaTypeFromJS(val, propType, converted.data())
3088 || QMetaType::convert(
3089 variant->metaType(), variant->constData(), propType, converted.data())) {
3090 return storeValueProperty(lookup, metaObject, target, converted.data());
3094 QLatin1String(
"Cannot assign ") + QLatin1String(variant->metaType().name())
3095 + QLatin1String(
" to ") + QLatin1String(propType.name()));
3127void initValueLookup(
3128 const AOTCompiledContext *aotContext, uint index,
const QMetaObject *metaObject)
3130 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
3131 if (v4->hasException) {
3132 v4->amendException();
3136 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
3137 initValueLookup(lookup, aotContext->compilationUnit, metaObject);
3138 lookup->call = QV4::Lookup::Call::SetterValueTypeProperty;
3200
3201
3202
3203
3204
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
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
3265
3266
3267
3268
3269
3270
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
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
3439
3440
3441
3442
3443
3444
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
3474
3475
3476
3477
3478
3479
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
3533
3534
3535
3536
3537
3538
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
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
3650
3651
3652
3653
3654
3655
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
3698
3699
3700
3701
3702
3703
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
3794
3795
3796
3797
3798
3799
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
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