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;
638 const QList<QTypeRevision> origRevisions = *revisions;
639 for (QTypeRevision revision : origRevisions) {
641 if (revision.hasMajorVersion()) {
642 revisionsHaveMajorVersions =
true;
643 if (revision.majorVersion() < defaultVersion.majorVersion())
644 revisions->append(QTypeRevision::fromVersion(revision.majorVersion(), 254));
648 if (revisionsHaveMajorVersions) {
649 if (!added.hasMajorVersion()) {
651 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(),
652 added.minorVersion()));
653 }
else if (added.majorVersion() < defaultVersion.majorVersion()) {
655 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(), 0));
659 std::sort(revisions->begin(), revisions->end());
660 const auto it = std::unique(revisions->begin(), revisions->end());
661 revisions->erase(it, revisions->end());
665 const QQmlPrivate::RegisterSingletonType &type)
667 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
668 siinfo->scriptCallback = type.scriptApi;
669 siinfo->qobjectCallback = type.qObjectApi;
670 siinfo->typeName = type.typeName;
671 return QQmlType::SingletonInstanceInfo::ConstPtr(
672 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
676 const QQmlPrivate::RegisterCompositeSingletonType &type)
678 QQmlType::SingletonInstanceInfo::Ptr siinfo = QQmlType::SingletonInstanceInfo::create();
679 siinfo->url = QQmlMetaType::normalizedUrl(type.url);
680 siinfo->typeName = type.typeName;
681 return QQmlType::SingletonInstanceInfo::ConstPtr(
682 siinfo.take(), QQmlType::SingletonInstanceInfo::ConstPtr::Adopt);
687 if (!dtype.isValid())
690 QQmlMetaType::registerUndeletableType(dtype);
691 return dtype.index();
694using ElementNames = QVarLengthArray<
const char *, 8>;
697 Q_ASSERT(metaObject);
698 const char *key =
"QML.Element";
700 const int offset = metaObject->classInfoOffset();
701 const int start = metaObject->classInfoCount() + offset - 1;
703 ElementNames elementNames;
705 for (
int i = start; i >= offset; --i) {
706 const QMetaClassInfo classInfo = metaObject->classInfo(i);
707 if (qstrcmp(key, classInfo.name()) == 0) {
708 const char *elementName = classInfo.value();
710 if (qstrcmp(elementName,
"auto") == 0) {
711 const char *strippedClassName = metaObject->className();
712 for (
const char *c = strippedClassName; *c !=
'\0'; c++) {
714 strippedClassName = c + 1;
716 elementName = strippedClassName;
717 }
else if (qstrcmp(elementName,
"anonymous") == 0) {
718 if (elementNames.isEmpty())
719 elementNames.push_back(
nullptr);
720 else if (elementNames[0] !=
nullptr)
721 qWarning() << metaObject->className() <<
"is both anonymous and named";
725 if (!elementNames.isEmpty() && elementNames[0] ==
nullptr) {
726 qWarning() << metaObject->className() <<
"is both anonymous and named";
727 elementNames[0] = elementName;
729 elementNames.push_back(elementName);
744 for (
int i = 1, end = elementNames->length(); i < end; ++i)
745 otherNames.append(QString::fromUtf8(elementNames->at(i)));
746 elementNames =
nullptr;
749 for (
const QString &otherName : std::as_const(otherNames))
750 QQmlMetaType::registerTypeAlias(typeId, otherName);
754 const ElementNames *elementNames;
755 QVarLengthArray<QString, 8> otherNames;
760 const QQmlPrivate::RegisterTypeAndRevisions &type,
761 const ElementNames &elementNames)
763 using namespace QQmlPrivate;
765 const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
766 const bool creatable = (elementNames[0] !=
nullptr || isValueType)
767 && boolClassInfo(type.classInfoMetaObject,
"QML.Creatable",
true);
769 QString noCreateReason;
770 ValueTypeCreationMethod creationMethod = ValueTypeCreationMethod::None;
773 noCreateReason = QString::fromUtf8(
774 classInfo(type.classInfoMetaObject,
"QML.UncreatableReason"));
775 if (noCreateReason.isEmpty())
776 noCreateReason = QLatin1String(
"Type cannot be created in QML.");
777 }
else if (isValueType) {
778 const char *method = classInfo(type.classInfoMetaObject,
"QML.CreationMethod");
779 if (qstrcmp(method,
"structured") == 0)
780 creationMethod = ValueTypeCreationMethod::Structured;
781 else if (qstrcmp(method,
"construct") == 0)
782 creationMethod = ValueTypeCreationMethod::Construct;
785 RegisterType typeRevision = {
786 QQmlPrivate::RegisterType::CurrentVersion,
789 creatable ? type.objectSize : 0,
793 type.createValueType,
798 type.attachedPropertiesFunction,
799 type.attachedPropertiesMetaObject,
800 type.parserStatusCast,
801 type.valueSourceCast,
802 type.valueInterceptorCast,
803 type.extensionObjectCreate,
804 type.extensionMetaObject,
807 type.structVersion > 0 ? type.finalizerCast : -1,
811 QQmlPrivate::RegisterSequentialContainer sequenceRevision = {
817 type.structVersion > 1 ? type.listMetaSequence : QMetaSequence(),
821 const QTypeRevision added = revisionClassInfo(
822 type.classInfoMetaObject,
"QML.AddedInVersion",
823 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
824 const QTypeRevision removed = revisionClassInfo(
825 type.classInfoMetaObject,
"QML.RemovedInVersion");
826 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
829 auto revisions = prepareRevisions(type.metaObject, added) + furtherRevisions;
830 if (type.attachedPropertiesMetaObject)
831 revisions += availableRevisions(type.attachedPropertiesMetaObject);
832 uniqueRevisions(&revisions, type.version, added);
835 for (QTypeRevision revision : std::as_const(revisions)) {
836 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
839 assignVersions(&typeRevision, revision, type.version);
842 if (typeRevision.version < added
843 || (removed.isValid() && !(typeRevision.version < removed))) {
844 typeRevision.elementName =
nullptr;
845 typeRevision.create =
nullptr;
846 typeRevision.userdata =
nullptr;
848 typeRevision.elementName = elementNames[0];
849 typeRevision.create = creatable ? type.create :
nullptr;
850 typeRevision.userdata = type.userdata;
853 typeRevision.customParser = type.customParserFactory();
854 const int id = qmlregister(TypeRegistration, &typeRevision);
856 type.qmlTypeIds->append(id);
858 if (typeRevision.elementName)
859 aliasRegistrar.registerAliases(id);
861 if (sequenceRevision.metaSequence != QMetaSequence()) {
862 sequenceRevision.version = typeRevision.version;
863 sequenceRevision.revision = typeRevision.revision;
864 const int id = QQmlPrivate::qmlregister(
865 QQmlPrivate::SequentialContainerRegistration, &sequenceRevision);
867 type.qmlTypeIds->append(id);
873 const QQmlPrivate::RegisterSingletonTypeAndRevisions &type,
874 const ElementNames &elementNames)
876 using namespace QQmlPrivate;
878 RegisterSingletonType revisionRegistration = {
885 type.instanceMetaObject,
887 type.extensionObjectCreate,
888 type.extensionMetaObject,
891 const QQmlType::SingletonInstanceInfo::ConstPtr siinfo
892 = singletonInstanceInfo(revisionRegistration);
894 const QTypeRevision added = revisionClassInfo(
895 type.classInfoMetaObject,
"QML.AddedInVersion",
896 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
897 const QTypeRevision removed = revisionClassInfo(
898 type.classInfoMetaObject,
"QML.RemovedInVersion");
899 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
902 auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions;
903 uniqueRevisions(&revisions, type.version, added);
906 for (QTypeRevision revision : std::as_const(revisions)) {
907 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
910 assignVersions(&revisionRegistration, revision, type.version);
913 if (revisionRegistration.version < added
914 || (removed.isValid() && !(revisionRegistration.version < removed))) {
915 revisionRegistration.typeName =
nullptr;
916 revisionRegistration.qObjectApi =
nullptr;
918 revisionRegistration.typeName = elementNames[0];
919 revisionRegistration.qObjectApi = type.qObjectApi;
922 const int id = finalizeType(
923 QQmlMetaType::registerSingletonType(revisionRegistration, siinfo));
925 type.qmlTypeIds->append(id);
927 if (revisionRegistration.typeName)
928 aliasRegistrar.registerAliases(id);
933
934
935
936int QQmlPrivate::qmlregister(RegistrationType type,
void *data)
939 case AutoParentRegistration:
940 return QQmlMetaType::registerAutoParentFunction(
941 *
reinterpret_cast<RegisterAutoParent *>(data));
942 case QmlUnitCacheHookRegistration:
943 return QQmlMetaType::registerUnitCacheHook(
944 *
reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
945 case TypeAndRevisionsRegistration: {
946 const RegisterTypeAndRevisions &type = *
reinterpret_cast<RegisterTypeAndRevisions *>(data);
947 if (type.structVersion > 1 && type.forceAnonymous) {
948 doRegisterTypeAndRevisions(type, {
nullptr});
950 const ElementNames names = classElementNames(type.classInfoMetaObject);
951 if (names.isEmpty()) {
952 qWarning().nospace() <<
"Missing QML.Element class info for "
953 << type.classInfoMetaObject->className();
955 doRegisterTypeAndRevisions(type, names);
961 case SingletonAndRevisionsRegistration: {
962 const RegisterSingletonTypeAndRevisions &type
963 = *
reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data);
964 const ElementNames names = classElementNames(type.classInfoMetaObject);
965 if (names.isEmpty()) {
966 qWarning().nospace() <<
"Missing QML.Element class info for "
967 << type.classInfoMetaObject->className();
969 doRegisterSingletonAndRevisions(type, names);
973 case SequentialContainerAndRevisionsRegistration: {
974 const RegisterSequentialContainerAndRevisions &type
975 = *
reinterpret_cast<RegisterSequentialContainerAndRevisions *>(data);
976 RegisterSequentialContainer revisionRegistration = {
986 const QTypeRevision added = revisionClassInfo(
987 type.classInfoMetaObject,
"QML.AddedInVersion",
988 QTypeRevision::fromMinorVersion(0));
989 QList<QTypeRevision> revisions = revisionClassInfos(
990 type.classInfoMetaObject,
"QML.ExtraVersion");
991 revisions.append(added);
992 uniqueRevisions(&revisions, type.version, added);
994 for (QTypeRevision revision : std::as_const(revisions)) {
995 if (revision < added)
997 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
1000 assignVersions(&revisionRegistration, revision, type.version);
1001 const int id = qmlregister(SequentialContainerRegistration, &revisionRegistration);
1002 if (type.qmlTypeIds)
1003 type.qmlTypeIds->append(id);
1007 case TypeRegistration:
1008 return finalizeType(
1009 QQmlMetaType::registerType(*
reinterpret_cast<RegisterType *>(data)));
1010 case InterfaceRegistration:
1011 return finalizeType(
1012 QQmlMetaType::registerInterface(*
reinterpret_cast<RegisterInterface *>(data)));
1013 case SingletonRegistration:
1014 return finalizeType(QQmlMetaType::registerSingletonType(
1015 *
reinterpret_cast<RegisterSingletonType *>(data),
1016 singletonInstanceInfo(*
reinterpret_cast<RegisterSingletonType *>(data))));
1017 case CompositeRegistration:
1018 return finalizeType(QQmlMetaType::registerCompositeType(
1019 *
reinterpret_cast<RegisterCompositeType *>(data)));
1020 case CompositeSingletonRegistration:
1021 return finalizeType(QQmlMetaType::registerCompositeSingletonType(
1022 *
reinterpret_cast<RegisterCompositeSingletonType *>(data),
1023 singletonInstanceInfo(*
reinterpret_cast<RegisterCompositeSingletonType *>(data))));
1024 case SequentialContainerRegistration:
1025 return finalizeType(QQmlMetaType::registerSequentialContainer(
1026 *
reinterpret_cast<RegisterSequentialContainer *>(data)));
1034void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data)
1037 case AutoParentRegistration:
1038 QQmlMetaType::unregisterAutoParentFunction(
reinterpret_cast<AutoParentFunction>(data));
1040 case QmlUnitCacheHookRegistration:
1041 QQmlMetaType::removeCachedUnitLookupFunction(
1042 reinterpret_cast<QmlUnitCacheLookupFunction>(data));
1044 case SequentialContainerRegistration:
1045 QQmlMetaType::unregisterSequentialContainer(data);
1047 case TypeRegistration:
1048 case InterfaceRegistration:
1049 case SingletonRegistration:
1050 case CompositeRegistration:
1051 case CompositeSingletonRegistration:
1052 QQmlMetaType::unregisterType(data);
1054 case TypeAndRevisionsRegistration:
1055 case SingletonAndRevisionsRegistration:
1056 case SequentialContainerAndRevisionsRegistration:
1066QList<QTypeRevision> QQmlPrivate::revisionClassInfos(
const QMetaObject *metaObject,
1069 QList<QTypeRevision> revisions;
1070 for (
int index = indexOfOwnClassInfo(metaObject, key); index != -1;
1071 index = indexOfOwnClassInfo(metaObject, key, index - 1)) {
1072 revisions.push_back(QTypeRevision::fromEncodedVersion(
1073 QLatin1StringView(metaObject->classInfo(index).value()).toInt()));
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
1109
1110
1111
1112int qmlRegisterTypeNotAvailable(
1113 const char *uri,
int versionMajor,
int versionMinor,
1114 const char *qmlName,
const QString &message)
1117 uri, versionMajor, versionMinor, qmlName, message);
1123 const char *uri,
int versionMajor,
const QMetaObject *classInfoMetaObject,
1124 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
bool)
1128 RegisterTypeAndRevisions type = {
1130 QmlMetaType<T>::self(),
1131 QmlMetaType<T>::list(),
1138 QTypeRevision::fromMajorVersion(versionMajor),
1140 &QQmlTypeNotAvailable::staticMetaObject,
1141 classInfoMetaObject,
1143 attachedPropertiesFunc<T>(),
1144 attachedPropertiesMetaObject<T>(),
1146 StaticCastSelector<T, QQmlParserStatus>::cast(),
1147 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1148 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1152 qmlCreateCustomParser<T>,
1154 QQmlPrivate::StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1156 QmlMetaType<T>::sequence(),
1159 qmlregister(TypeAndRevisionsRegistration, &type);
1177 QQmlEngine *engine = aotContext->qmlEngine();
1178 return engine ? QQmlEnginePrivate::get(aotContext->qmlEngine())->propertyCapture :
nullptr;
1211static bool markPointer(
const QVariant &element, QV4::MarkStack *markStack)
1213 if (!element.metaType().flags().testFlag(QMetaType::PointerToQObject))
1216 QV4::QObjectWrapper::markWrapper(
1217 *
static_cast<QObject *
const *>(element.constData()), markStack);
1223#define ADD_CASE(Type, id, T)
1224 case QMetaType::Type:
1226 const QMetaType elementMetaType = element.metaType();
1227 switch (elementMetaType.id()) {
1228 case QMetaType::QVariantMap:
1229 for (
const QVariant &variant : *
static_cast<
const QVariantMap *>(element.constData()))
1230 elements->push_back(variant);
1232 case QMetaType::QVariantHash:
1233 for (
const QVariant &variant : *
static_cast<
const QVariantHash *>(element.constData()))
1234 elements->push_back(variant);
1236 case QMetaType::QVariantList:
1237 for (
const QVariant &variant : *
static_cast<
const QVariantList *>(element.constData()))
1238 elements->push_back(variant);
1240 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1241 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1242 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1243 case QMetaType::QStringList:
1244 case QMetaType::QByteArrayList:
1250 if (elementMetaType == QMetaType::fromType<QJSValue>()
1251 || elementMetaType == QMetaType::fromType<QJSManagedValue>()
1252 || elementMetaType == QMetaType::fromType<QJSPrimitiveValue>()) {
1258 QMetaSequence::Iterable iterable;
1259 if (!QMetaType::convert(
1260 element.metaType(), element.constData(),
1261 QMetaType::fromType<QMetaSequence::Iterable>(), &iterable)) {
1265 switch (iterable.metaContainer().valueMetaType().id()) {
1266 QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(ADD_CASE)
1267 QT_FOR_EACH_STATIC_CORE_CLASS(ADD_CASE)
1268 QT_FOR_EACH_STATIC_GUI_CLASS(ADD_CASE)
1269 case QMetaType::QStringList:
1270 case QMetaType::QByteArrayList:
1276 for (
auto it = iterable.constBegin(), end = iterable.constEnd(); it != end; ++it)
1277 elements->push_back(*it);
1320static bool inherits(
const QQmlPropertyCache *descendent,
const QQmlPropertyCache *ancestor)
1322 for (
const QQmlPropertyCache *cache = descendent; cache; cache = cache->parent().data()) {
1323 if (cache == ancestor)
1422 void *
a[] = {
target,
nullptr };
1434 void *
a[] = {
source,
nullptr };
1526template<
typename Op>
1556 void *
args[] = {
nullptr };
1575 const bool isUnsigned = enumType.flags() & QMetaType::IsUnsignedEnumeration;
1576 switch (enumType.sizeOf()) {
1579 ? numberType == QMetaType::fromType<quint8>()
1580 : numberType == QMetaType::fromType<qint8>();
1583 ? numberType == QMetaType::fromType<ushort>()
1584 : numberType == QMetaType::fromType<
short>();
1591 ? (numberType == QMetaType::fromType<
int>()
1592 || numberType == QMetaType::fromType<uint>())
1593 : numberType == QMetaType::fromType<
int>();
1596 ? numberType == QMetaType::fromType<qulonglong>()
1597 : numberType == QMetaType::fromType<qlonglong>();
1606 return !type.isValid()
1607 || type == QMetaType::fromType<QVariant>()
1608 || type == QMetaType::fromType<QJSPrimitiveValue>();
1613 if (source == target)
1616 if ((source.flags() & QMetaType::IsQmlList)
1617 && (target.flags() & QMetaType::IsQmlList)) {
1623 if (target.flags() & QMetaType::PointerToQObject) {
1626 const QMetaObject *targetMetaObject = target.metaObject();
1627 const QMetaObject *sourceMetaObject = source.metaObject();
1628 if (!sourceMetaObject)
1629 sourceMetaObject = QQmlMetaType::metaObjectForType(source).metaObject();
1631 while (sourceMetaObject && sourceMetaObject != targetMetaObject)
1632 sourceMetaObject = sourceMetaObject->superClass();
1634 return sourceMetaObject !=
nullptr;
1637 if (target.flags() & QMetaType::IsEnumeration)
1638 return isEnumUnderlyingType(target, source);
1640 if (source.flags() & QMetaType::IsEnumeration)
1641 return isEnumUnderlyingType(source, target);
1643 if (!source.isValid())
1644 return canHoldVoid(target);
1715template<QV4::Lookup::Call FallbackCall>
1717 const AOTCompiledContext *aotContext, QV4::Lookup *lookup, QObject *object)
1719 QV4::Scope scope(aotContext->engine->handle());
1720 QV4::PropertyKey id = scope.engine->identifierTable->asPropertyKey(
1721 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]);
1723 Q_ASSERT(id.isString());
1725 QV4::ScopedString name(scope, id.asStringOrSymbol());
1727 Q_ASSERT(!name->equals(scope.engine->id_toString()));
1728 Q_ASSERT(!name->equals(scope.engine->id_destroy()));
1730 QQmlData *ddata = QQmlData::get(object,
true);
1732 if (ddata->isQueuedForDeletion)
1735 const QQmlPropertyData *property;
1736 if (!ddata->propertyCache) {
1737 property = QQmlPropertyCache::property(object, name, aotContext->qmlContext,
nullptr);
1739 property = ddata->propertyCache->property(
1740 name.getPointer(), object, aotContext->qmlContext);
1744 const QMetaObject *metaObject = object->metaObject();
1748 const int coreIndex = metaObject->indexOfProperty(
1749 name->toQStringNoThrow().toUtf8().constData());
1753 const QMetaProperty property = metaObject->property(coreIndex);
1755 lookup->releasePropertyCache();
1757 lookup->qobjectFallbackLookup.metaObject = quintptr(metaObject) + 1;
1758 lookup->qobjectFallbackLookup.metaType = quintptr(property.metaType().iface()) + 1;
1759 lookup->qobjectFallbackLookup.coreIndex = coreIndex;
1760 lookup->qobjectFallbackLookup.notifyIndex =
1761 QMetaObjectPrivate::signalIndex(property.notifySignal());
1763 if constexpr (FallbackCall == QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback
1764 || FallbackCall == QV4::Lookup::Call::GetterQObjectPropertyFallback) {
1765 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isConstant() ? 1 : 0;
1766 }
else if constexpr (FallbackCall == QV4::Lookup::Call::SetterQObjectPropertyFallback) {
1767 lookup->qobjectFallbackLookup.isConstantOrResettable = property.isResettable() ? 1 : 0;
1772 Q_ASSERT(ddata->propertyCache);
1774 QV4::setupQObjectLookup(lookup, ddata, property);
1780template<QV4::Lookup::Call ObjectCall, QV4::Lookup::Call FallbackCall,
LookupType Type>
1783 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
1784 if (v4->hasException) {
1785 v4->amendException();
1789 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
1790 switch (initObjectLookup<FallbackCall>(aotContext, lookup, object)) {
1792 lookup->call = ObjectCall;
1796 lookup->call = FallbackCall;
1800 v4->throwTypeError();
1809 QV4::Lookup *lookup, QV4::ExecutableCompilationUnit *compilationUnit,
1810 const QMetaObject *metaObject)
1812 Q_ASSERT(metaObject);
1813 const QByteArray name = compilationUnit->runtimeStrings[lookup->nameIndex]->toQString().toUtf8();
1814 const int coreIndex = metaObject->indexOfProperty(name.constData());
1815 QMetaType lookupType = metaObject->property(coreIndex).metaType();
1816 lookup->qgadgetLookup.metaObject = quintptr(metaObject) + 1;
1817 lookup->qgadgetLookup.coreIndex = coreIndex;
1818 lookup->qgadgetLookup.metaType = lookupType.iface();
1882#if QT_CONFIG(translation)
1932 if (type == QMetaType::fromType<QVariant>())
1933 return !
static_cast<
const QVariant *>(value)->isValid();
1934 if (type == QMetaType::fromType<QJSValue>())
1935 return static_cast<
const QJSValue *>(value)->isUndefined();
1936 if (type == QMetaType::fromType<QJSPrimitiveValue>()) {
1937 return static_cast<
const QJSPrimitiveValue *>(value)->type()
1938 == QJSPrimitiveValue::Undefined;
2037 QStringLiteral(
"Value is null and could not be converted to an object"));
2063 QStringLiteral(
"A QmlLoggingCatgory was provided without a valid name"));
2131 const QQmlType &type,
const QV4::CompiledData::ParameterType ¶meter)
2133 return parameter.isList() ? type.qListTypeId() : type.typeId();
2184 for (
int i = 0;
i <
argc; ++
i)
2258 const AOTCompiledContext *aotContext, QV4::Lookup *lookup,
const QString &object)
2260 aotContext->engine->handle()->throwTypeError(
2261 QStringLiteral(
"Property '%1' of object %2 is not a function").arg(
2262 aotContext->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString(),
2290 QV4::QObjectMethod *method, QV4::Lookup *lookup,
int relativeMethodIndex)
2292 Q_ASSERT(lookup->qobjectMethodLookup.method.get() == method->d());
2294 const auto *d = method->d();
2295 const int methodCount = d->methodCount;
2297 if (methodCount == 1) {
2306 lookup->qobjectMethodLookup.propertyData = d->methods;
2310 for (
int i = 0, end = d->methodCount; i != end; ++i) {
2311 const QMetaMethod metaMethod = d->methods[i].metaMethod();
2312 if (metaMethod.relativeMethodIndex() != relativeMethodIndex)
2315 lookup->qobjectMethodLookup.propertyData = d->methods + i;
2665template<QV4::Lookup::Call call>
2666static void initTypeWrapperLookup(
2667 const AOTCompiledContext *context, QV4::Lookup *lookup, uint importNamespace)
2669 Q_ASSERT(!context->engine->hasError());
2670 if (importNamespace != AOTCompiledContext::InvalidStringId) {
2671 QV4::Scope scope(context->engine->handle());
2672 QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]);
2674 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2675 Q_ASSERT(typeLoader);
2676 if (
const QQmlImportRef *importRef
2677 = context->qmlContext->imports()->query(import, typeLoader).importNamespace) {
2679 QV4::Scoped<QV4::QQmlTypeWrapper> wrapper(
2680 scope, QV4::QQmlTypeWrapper::create(
2681 scope.engine,
nullptr, context->qmlContext->imports(), importRef));
2684 wrapper = lookup->getter(context->engine->handle(), wrapper);
2687 lookup->releasePropertyCache();
2689 lookup->call = call;
2691 case QV4::Lookup::Call::ContextGetterSingleton:
2692 lookup->qmlContextSingletonLookup.singletonObject.set(scope.engine, wrapper->heapObject());
2694 case QV4::Lookup::Call::ContextGetterType:
2695 lookup->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->heapObject());
2702 scope.engine->throwTypeError();
2704 QV4::ExecutionEngine *v4 = context->engine->handle();
2705 lookup->contextGetter(v4,
nullptr);
2706 if (lookup->call != call) {
2708 = QLatin1String(call == QV4::Lookup::Call::ContextGetterSingleton
2709 ?
"%1 was a singleton at compile time, "
2710 "but is not a singleton anymore."
2711 :
"%1 was not a singleton at compile time, "
2712 "but is a singleton now.")
2713 .arg(context->compilationUnit->runtimeStrings[lookup->nameIndex]->toQString());
2714 v4->throwTypeError(error);
2994 QStringLiteral(
"Value is null and could not be converted to an object"));
3048 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target,
void *value)
3050 void *args[] = { value,
nullptr };
3051 metaObject->d.static_metacall(
3052 reinterpret_cast<QObject *>(target), QMetaObject::WriteProperty,
3053 lookup->qgadgetLookup.coreIndex, args);
3058 QV4::Lookup *lookup,
const QMetaObject *metaObject,
void *target, QV4::ExecutionEngine *v4)
3060 const QMetaProperty property = metaObject->property(lookup->qgadgetLookup.coreIndex);
3061 if (property.isResettable()) {
3062 void *args[] = {
nullptr };
3063 metaObject->d.static_metacall(
3064 reinterpret_cast<QObject *>(target), QMetaObject::ResetProperty,
3065 lookup->qgadgetLookup.coreIndex, args);
3068 QLatin1String(
"Cannot assign [undefined] to ") +
3069 QLatin1String(property.metaType().name()));
3076 QV4::ExecutionEngine *v4, QV4::Lookup *lookup,
const QMetaObject *metaObject,
3077 void *target,
void *value)
3079 QVariant *variant =
static_cast<QVariant *>(value);
3080 const QMetaType propType = metaObject->property(lookup->qgadgetLookup.coreIndex).metaType();
3081 if (propType == QMetaType::fromType<QVariant>())
3082 return storeValueProperty(lookup, metaObject, target, variant);
3084 if (!variant->isValid())
3085 return resetValueProperty(lookup, metaObject, target, v4);
3087 if (isTypeCompatible(variant->metaType(), propType))
3088 return storeValueProperty(lookup, metaObject, target, variant->data());
3090 QVariant converted(propType);
3091 QV4::Scope scope(v4);
3092 QV4::ScopedValue val(scope, v4->fromVariant(*variant));
3093 if (v4->metaTypeFromJS(val, propType, converted.data())
3094 || QMetaType::convert(
3095 variant->metaType(), variant->constData(), propType, converted.data())) {
3096 return storeValueProperty(lookup, metaObject, target, converted.data());
3100 QLatin1String(
"Cannot assign ") + QLatin1String(variant->metaType().name())
3101 + QLatin1String(
" to ") + QLatin1String(propType.name()));
3133void initValueLookup(
3134 const AOTCompiledContext *aotContext, uint index,
const QMetaObject *metaObject)
3136 QV4::ExecutionEngine *v4 = aotContext->engine->handle();
3137 if (v4->hasException) {
3138 v4->amendException();
3142 QV4::Lookup *lookup = aotContext->compilationUnit->runtimeLookups + index;
3143 initValueLookup(lookup, aotContext->compilationUnit, metaObject);
3144 lookup->call = QV4::Lookup::Call::SetterValueTypeProperty;
3206
3207
3208
3209
3210
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
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
3273
3274
3275
3276
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
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
3447
3448
3449
3450
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
3482
3483
3484
3485
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
3541
3542
3543
3544
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
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
3658
3659
3660
3661
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
3706
3707
3708
3709
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
3802
3803
3804
3805
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
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 void resolveQObjectMethodOverload(QV4::QObjectMethod *method, QV4::Lookup *lookup, int relativeMethodIndex)
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)
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