Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqml.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qqml.h"
5
6#include <QtQml/qqmlprivate.h>
7
8#include <private/qjsvalue_p.h>
9#include <private/qqmlbuiltinfunctions_p.h>
10#include <private/qqmlcomponent_p.h>
11#include <private/qqmlengine_p.h>
12#include <private/qqmlfinalizer_p.h>
13#include <private/qqmlloggingcategory_p.h>
14#include <private/qqmlmetatype_p.h>
15#include <private/qqmlmetatypedata_p.h>
16#include <private/qqmltype_p_p.h>
17#include <private/qqmltypemodule_p.h>
18#include <private/qqmltypewrapper_p.h>
19#include <private/qqmlvaluetypewrapper_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>
25
26#include <QtCore/qmutex.h>
27
29
32
50{
51 QQmlData *data = QQmlData::get(object);
52
53 if (!data
54 || !data->context
55 || !data->context->engine()
56 || data->deferredData.isEmpty()
57 || data->wasDeleted(object)) {
58 return;
59 }
60
61 if (!data->propertyCache)
62 data->propertyCache = QQmlMetaType::propertyCache(object->metaObject());
63
64 QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine());
65
68
69 // Release the reference for the deferral action (we still have one from construction)
70 data->releaseDeferredData();
71
73}
74
79
81{
83 if (!data || !data->context)
84 return nullptr;
85 return data->context->engine();
86}
87
89 QObject *object, bool create)
90{
91 if (!pf)
92 return nullptr;
93
94 QObject *rv = data->hasExtendedData() ? data->attachedProperties()->value(pf) : 0;
95 if (rv || !create)
96 return rv;
97
98 rv = pf(object);
99
100 if (rv)
101 data->attachedProperties()->insert(pf, rv);
102
103 return rv;
104}
105
107 const QMetaObject *attachedMetaObject)
108{
109 QQmlEngine *engine = object ? qmlEngine(object) : nullptr;
111 attachedMetaObject);
112}
113
115{
116 if (!object)
117 return nullptr;
118
119 QQmlData *data = QQmlData::get(object, create);
120
121 // Attached properties are only on objects created by QML,
122 // unless explicitly requested (create==true)
123 if (!data)
124 return nullptr;
125
126 return resolveAttachedProperties(func, data, object, create);
127}
128
130{
131 return QQmlPrivate::qmlExtendedObject(object, 0);
132}
133
135{
136 if (!object)
137 return nullptr;
138
139 void *result = nullptr;
141 if (!d->metaObject)
142 return nullptr;
143
144 const int id = d->metaObject->metaCall(
148 return nullptr;
149
150 return static_cast<QObject *>(result);
151}
152
155{
156 switch (warning) {
158 qWarning().nospace()
159 << metaType.name()
160 << " is neither a default constructible QObject, nor a default- "
161 << "and copy-constructible Q_GADGET, nor marked as uncreatable.\n"
162 << "You should not use it as a QML type.";
163 break;
165 qWarning()
166 << "Singleton" << metaType.name()
167 << "needs to be a concrete class with either a default constructor"
168 << "or, when adding a default constructor is infeasible, a public static"
169 << "create(QQmlEngine *, QJSEngine *) method.";
170 break;
172 qWarning()
173 << metaType.name()
174 << "is not a QObject, but has attached properties. This won't work.";
175 break;
176 }
177}
178
180 QV4::ExecutableCompilationUnit *unit, const QString &elementName)
181{
183 unit->baseCompilationUnit(), unit->engine->typeLoader(), elementName)
184 .typeId();
185}
186
188 QV4::ExecutableCompilationUnit *unit, const QString &elementName)
189{
191 unit->baseCompilationUnit(), unit->engine->typeLoader(), elementName)
192 .qListTypeId();
193}
194
196 const char *uri, int versionMajor,
197 int versionMinor, const char *qmlName,
198 const QString& reason)
199{
202 QMetaType(),
203 QMetaType(),
204 0,
205 nullptr,
206 nullptr,
207 reason,
208 nullptr,
209
210 uri, QTypeRevision::fromVersion(versionMajor, versionMinor), qmlName, &staticMetaObject,
211
213 nullptr,
214
215 -1,
216 -1,
217 -1,
218
219 nullptr, nullptr,
220
221 nullptr,
223 -1,
225 };
226
228}
229
230void qmlClearTypeRegistrations() // Declared in qqml.h
231{
233 QQmlEnginePrivate::baseModulesUninitialized = true; //So the engine re-registers its types
235}
236
237//From qqml.h
238bool qmlProtectModule(const char *uri, int majVersion)
239{
242}
243
244//From qqml.h
245void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor)
246{
247 QQmlMetaType::registerModule(uri, QTypeRevision::fromVersion(versionMajor, versionMinor));
248}
249
250static QQmlDirParser::Import resolveImport(const QString &uri, int importMajor, int importMinor)
251{
252 if (importMajor == QQmlModuleImportAuto)
254 else if (importMajor == QQmlModuleImportLatest)
256 else if (importMinor == QQmlModuleImportLatest)
259}
260
261static QTypeRevision resolveModuleVersion(int moduleMajor)
262{
263 return moduleMajor == QQmlModuleImportModuleAny
264 ? QTypeRevision()
265 : QTypeRevision::fromMajorVersion(moduleMajor);
266}
267
328void qmlRegisterModuleImport(const char *uri, int moduleMajor,
329 const char *import, int importMajor, int importMinor)
330{
332 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
333 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
334}
335
336
348void qmlUnregisterModuleImport(const char *uri, int moduleMajor,
349 const char *import, int importMajor, int importMinor)
350{
352 QString::fromUtf8(uri), resolveModuleVersion(moduleMajor),
353 resolveImport(QString::fromUtf8(import), importMajor, importMinor));
354}
355
356//From qqml.h
357int qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
358{
359 return QQmlMetaType::typeId(uri, QTypeRevision::fromVersion(versionMajor, versionMinor), qmlName);
360}
361
363{
364 if (!instance) {
366 error.setDescription(QStringLiteral("The registered singleton has already been deleted. "
367 "Ensure that it outlives the engine."));
369 return false;
370 }
371
372 if (engine->thread() != instance->thread()) {
374 error.setDescription(QStringLiteral("Registered object must live in the same thread "
375 "as the engine it was registered with"));
377 return false;
378 }
379
380 return true;
381}
382
383// From qqmlprivate.h
384#if QT_DEPRECATED_SINCE(6, 3)
385QObject *QQmlPrivate::SingletonFunctor::operator()(QQmlEngine *qeng, QJSEngine *)
386{
387 if (!checkSingletonInstance(qeng, m_object))
388 return nullptr;
389
390 if (alreadyCalled) {
392 error.setDescription(QStringLiteral("Singleton registered by registerSingletonInstance "
393 "must only be accessed from one engine"));
394 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
395 return nullptr;
396 }
397
398 alreadyCalled = true;
400 return m_object;
401};
402#endif
403
405{
407 return nullptr;
408
409 if (!m_engine) {
410 m_engine = qeng;
412 } else if (m_engine != qeng) {
414 error.setDescription(QLatin1String("Singleton registered by registerSingletonInstance must only be accessed from one engine"));
415 QQmlEnginePrivate::get(qeng)->warning(qeng, error);
416 return nullptr;
417 }
418
419 return m_object;
420};
421
422static QVector<QTypeRevision> availableRevisions(const QMetaObject *metaObject)
423{
424 QVector<QTypeRevision> revisions;
425 if (!metaObject)
426 return revisions;
427 const int propertyOffset = metaObject->propertyOffset();
428 const int propertyCount = metaObject->propertyCount();
429 for (int coreIndex = propertyOffset, propertyEnd = propertyOffset + propertyCount;
430 coreIndex < propertyEnd; ++coreIndex) {
431 const QMetaProperty property = metaObject->property(coreIndex);
432 if (int revision = property.revision())
433 revisions.append(QTypeRevision::fromEncodedVersion(revision));
434 }
435 const int methodOffset = metaObject->methodOffset();
436 const int methodCount = metaObject->methodCount();
437 for (int methodIndex = methodOffset, methodEnd = methodOffset + methodCount;
438 methodIndex < methodEnd; ++methodIndex) {
439 const QMetaMethod method = metaObject->method(methodIndex);
440 if (int revision = method.revision())
441 revisions.append(QTypeRevision::fromEncodedVersion(revision));
442 }
443
444 // Need to also check parent meta objects, as their revisions are inherited.
445 if (const QMetaObject *superMeta = metaObject->superClass())
446 revisions += availableRevisions(superMeta);
447
448 return revisions;
449}
450
451template<typename Registration>
452void assignVersions(Registration *registration, QTypeRevision revision,
453 QTypeRevision defaultVersion)
454{
455 const quint8 majorVersion = revision.hasMajorVersion() ? revision.majorVersion()
456 : defaultVersion.majorVersion();
457 registration->version = revision.hasMinorVersion()
458 ? QTypeRevision::fromVersion(majorVersion, revision.minorVersion())
459 : QTypeRevision::fromMajorVersion(majorVersion);
460 registration->revision = revision;
461}
462
463static QVector<QTypeRevision> prepareRevisions(const QMetaObject *metaObject, QTypeRevision added)
464{
465 auto revisions = availableRevisions(metaObject);
466 revisions.append(added);
467 return revisions;
468}
469
470static void uniqueRevisions(QVector<QTypeRevision> *revisions, QTypeRevision defaultVersion,
471 QTypeRevision added)
472{
473 bool revisionsHaveMajorVersions = false;
474 for (QTypeRevision revision : QVector<QTypeRevision>(*revisions)) { // yes, copy
475 // allow any minor version for each explicitly specified past major one
476 if (revision.hasMajorVersion()) {
477 revisionsHaveMajorVersions = true;
478 if (revision.majorVersion() < defaultVersion.majorVersion())
479 revisions->append(QTypeRevision::fromVersion(revision.majorVersion(), 254));
480 }
481 }
482
483 if (revisionsHaveMajorVersions) {
484 if (!added.hasMajorVersion()) {
485 // If added in unspecified major version, assume default one.
486 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(),
487 added.minorVersion()));
488 } else if (added.majorVersion() < defaultVersion.majorVersion()) {
489 // If added in past major version, add .0 of default version.
490 revisions->append(QTypeRevision::fromVersion(defaultVersion.majorVersion(), 0));
491 }
492 }
493
494 std::sort(revisions->begin(), revisions->end());
495 const auto it = std::unique(revisions->begin(), revisions->end());
496 revisions->erase(it, revisions->end());
497}
498
501{
503 siinfo->scriptCallback = type.scriptApi;
504 siinfo->qobjectCallback = type.qObjectApi;
505 siinfo->typeName = type.typeName;
508}
509
519
520static int finalizeType(const QQmlType &dtype)
521{
522 if (!dtype.isValid())
523 return -1;
524
526 return dtype.index();
527}
528
529using ElementNames = QVarLengthArray<const char *, 8>;
531{
533 const char *key = "QML.Element";
534
535 const int offset = metaObject->classInfoOffset();
536 const int start = metaObject->classInfoCount() + offset - 1;
537
538 ElementNames elementNames;
539
540 for (int i = start; i >= offset; --i) {
541 const QMetaClassInfo classInfo = metaObject->classInfo(i);
542 if (qstrcmp(key, classInfo.name()) == 0) {
543 const char *elementName = classInfo.value();
544
545 if (qstrcmp(elementName, "auto") == 0) {
546 const char *strippedClassName = metaObject->className();
547 for (const char *c = strippedClassName; *c != '\0'; c++) {
548 if (*c == ':')
549 strippedClassName = c + 1;
550 }
551 elementName = strippedClassName;
552 } else if (qstrcmp(elementName, "anonymous") == 0) {
553 if (elementNames.isEmpty())
554 elementNames.push_back(nullptr);
555 else if (elementNames[0] != nullptr)
556 qWarning() << metaObject->className() << "is both anonymous and named";
557 continue;
558 }
559
560 if (!elementNames.isEmpty() && elementNames[0] == nullptr) {
561 qWarning() << metaObject->className() << "is both anonymous and named";
562 elementNames[0] = elementName;
563 } else {
564 elementNames.push_back(elementName);
565 }
566 }
567 }
568
569 return elementNames;
570}
571
573{
574 AliasRegistrar(const ElementNames *elementNames) : elementNames(elementNames) {}
575
576 void registerAliases(int typeId)
577 {
578 if (elementNames) {
579 for (int i = 1, end = elementNames->length(); i < end; ++i)
580 otherNames.append(QString::fromUtf8(elementNames->at(i)));
581 elementNames = nullptr;
582 }
583
584 for (const QString &otherName : std::as_const(otherNames))
585 QQmlMetaType::registerTypeAlias(typeId, otherName);
586 }
587
588private:
589 const ElementNames *elementNames;
590 QVarLengthArray<QString, 8> otherNames;
591};
592
593
596 const ElementNames &elementNames)
597{
598 using namespace QQmlPrivate;
599
600 const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
601 const bool creatable = (elementNames[0] != nullptr || isValueType)
602 && boolClassInfo(type.classInfoMetaObject, "QML.Creatable", true);
603
604 QString noCreateReason;
606
607 if (!creatable) {
608 noCreateReason = QString::fromUtf8(
609 classInfo(type.classInfoMetaObject, "QML.UncreatableReason"));
610 if (noCreateReason.isEmpty())
611 noCreateReason = QLatin1String("Type cannot be created in QML.");
612 } else if (isValueType) {
613 const char *method = classInfo(type.classInfoMetaObject, "QML.CreationMethod");
614 if (qstrcmp(method, "structured") == 0)
616 else if (qstrcmp(method, "construct") == 0)
617 creationMethod = ValueTypeCreationMethod::Construct;
618 }
619
620 RegisterType typeRevision = {
622 type.typeId,
623 type.listId,
624 creatable ? type.objectSize : 0,
625 nullptr,
626 nullptr,
627 noCreateReason,
628 type.createValueType,
629 type.uri,
630 type.version,
631 nullptr,
633 type.attachedPropertiesFunction,
634 type.attachedPropertiesMetaObject,
635 type.parserStatusCast,
636 type.valueSourceCast,
637 type.valueInterceptorCast,
638 type.extensionObjectCreate,
639 type.extensionMetaObject,
640 nullptr,
642 type.structVersion > 0 ? type.finalizerCast : -1,
643 creationMethod
644 };
645
647 0,
648 type.uri,
649 type.version,
650 nullptr,
651 type.listId,
652 type.structVersion > 1 ? type.listMetaSequence : QMetaSequence(),
654 };
655
656 const QTypeRevision added = revisionClassInfo(
657 type.classInfoMetaObject, "QML.AddedInVersion",
658 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
659 const QTypeRevision removed = revisionClassInfo(
660 type.classInfoMetaObject, "QML.RemovedInVersion");
661 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
662 "QML.ExtraVersion");
663
664 auto revisions = prepareRevisions(type.metaObject, added) + furtherRevisions;
665 if (type.attachedPropertiesMetaObject)
666 revisions += availableRevisions(type.attachedPropertiesMetaObject);
667 uniqueRevisions(&revisions, type.version, added);
668
669 AliasRegistrar aliasRegistrar(&elementNames);
670 for (QTypeRevision revision : revisions) {
671 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
672 break;
673
674 assignVersions(&typeRevision, revision, type.version);
675
676 // When removed or before added, we still add revisions, but anonymous ones
677 if (typeRevision.version < added
678 || (removed.isValid() && !(typeRevision.version < removed))) {
679 typeRevision.elementName = nullptr;
680 typeRevision.create = nullptr;
681 typeRevision.userdata = nullptr;
682 } else {
683 typeRevision.elementName = elementNames[0];
684 typeRevision.create = creatable ? type.create : nullptr;
685 typeRevision.userdata = type.userdata;
686 }
687
688 typeRevision.customParser = type.customParserFactory();
689 const int id = qmlregister(TypeRegistration, &typeRevision);
690 if (type.qmlTypeIds)
691 type.qmlTypeIds->append(id);
692
693 if (typeRevision.elementName)
694 aliasRegistrar.registerAliases(id);
695
696 if (sequenceRevision.metaSequence != QMetaSequence()) {
697 sequenceRevision.version = typeRevision.version;
698 sequenceRevision.revision = typeRevision.revision;
699 const int id = QQmlPrivate::qmlregister(
701 if (type.qmlTypeIds)
702 type.qmlTypeIds->append(id);
703 }
704 }
705}
706
709 const ElementNames &elementNames)
710{
711 using namespace QQmlPrivate;
712
713 RegisterSingletonType revisionRegistration = {
714 0,
715 type.uri,
716 type.version,
717 elementNames[0],
718 nullptr,
719 type.qObjectApi,
720 type.instanceMetaObject,
721 type.typeId,
722 type.extensionObjectCreate,
723 type.extensionMetaObject,
725 };
727 = singletonInstanceInfo(revisionRegistration);
728
729 const QTypeRevision added = revisionClassInfo(
730 type.classInfoMetaObject, "QML.AddedInVersion",
731 QTypeRevision::fromVersion(type.version.majorVersion(), 0));
732 const QTypeRevision removed = revisionClassInfo(
733 type.classInfoMetaObject, "QML.RemovedInVersion");
734 const QList<QTypeRevision> furtherRevisions = revisionClassInfos(type.classInfoMetaObject,
735 "QML.ExtraVersion");
736
737 auto revisions = prepareRevisions(type.instanceMetaObject, added) + furtherRevisions;
738 uniqueRevisions(&revisions, type.version, added);
739
740 AliasRegistrar aliasRegistrar(&elementNames);
741 for (QTypeRevision revision : std::as_const(revisions)) {
742 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
743 break;
744
745 assignVersions(&revisionRegistration, revision, type.version);
746
747 // When removed or before added, we still add revisions, but anonymous ones
748 if (revisionRegistration.version < added
749 || (removed.isValid() && !(revisionRegistration.version < removed))) {
750 revisionRegistration.typeName = nullptr;
751 revisionRegistration.qObjectApi = nullptr;
752 } else {
753 revisionRegistration.typeName = elementNames[0];
754 revisionRegistration.qObjectApi = type.qObjectApi;
755 }
756
757 const int id = finalizeType(
758 QQmlMetaType::registerSingletonType(revisionRegistration, siinfo));
759 if (type.qmlTypeIds)
760 type.qmlTypeIds->append(id);
761
762 if (revisionRegistration.typeName)
763 aliasRegistrar.registerAliases(id);
764 }
765}
766
767/*
768This method is "over generalized" to allow us to (potentially) register more types of things in
769the future without adding exported symbols.
770*/
772{
773 switch (type) {
776 *reinterpret_cast<RegisterAutoParent *>(data));
779 *reinterpret_cast<RegisterQmlUnitCacheHook *>(data));
781 const RegisterTypeAndRevisions &type = *reinterpret_cast<RegisterTypeAndRevisions *>(data);
782 if (type.structVersion > 1 && type.forceAnonymous) {
784 } else {
785 const ElementNames names = classElementNames(type.classInfoMetaObject);
786 if (names.isEmpty()) {
787 qWarning().nospace() << "Missing QML.Element class info for "
788 << type.classInfoMetaObject->className();
789 } else {
791 }
792
793 }
794 break;
795 }
798 = *reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data);
799 const ElementNames names = classElementNames(type.classInfoMetaObject);
800 if (names.isEmpty()) {
801 qWarning().nospace() << "Missing QML.Element class info for "
802 << type.classInfoMetaObject->className();
803 } else {
805 }
806 break;
807 }
810 = *reinterpret_cast<RegisterSequentialContainerAndRevisions *>(data);
811 RegisterSequentialContainer revisionRegistration = {
812 0,
813 type.uri,
814 type.version,
815 nullptr,
816 type.typeId,
817 type.metaSequence,
819 };
820
821 const QTypeRevision added = revisionClassInfo(
822 type.classInfoMetaObject, "QML.AddedInVersion",
824 QList<QTypeRevision> revisions = revisionClassInfos(
825 type.classInfoMetaObject, "QML.ExtraVersion");
826 revisions.append(added);
827 uniqueRevisions(&revisions, type.version, added);
828
829 for (QTypeRevision revision : std::as_const(revisions)) {
830 if (revision < added)
831 continue;
832 if (revision.hasMajorVersion() && revision.majorVersion() > type.version.majorVersion())
833 break;
834
835 assignVersions(&revisionRegistration, revision, type.version);
836 const int id = qmlregister(SequentialContainerRegistration, &revisionRegistration);
837 if (type.qmlTypeIds)
838 type.qmlTypeIds->append(id);
839 }
840 break;
841 }
842 case TypeRegistration:
843 return finalizeType(
844 QQmlMetaType::registerType(*reinterpret_cast<RegisterType *>(data)));
846 return finalizeType(
850 *reinterpret_cast<RegisterSingletonType *>(data),
851 singletonInstanceInfo(*reinterpret_cast<RegisterSingletonType *>(data))));
854 *reinterpret_cast<RegisterCompositeType *>(data)));
857 *reinterpret_cast<RegisterCompositeSingletonType *>(data),
861 *reinterpret_cast<RegisterSequentialContainer *>(data)));
862 default:
863 return -1;
864 }
865
866 return -1;
867}
868
870{
871 switch (type) {
874 break;
877 reinterpret_cast<QmlUnitCacheLookupFunction>(data));
878 break;
881 break;
882 case TypeRegistration:
888 break;
892 // Currently unnecessary. We'd need a special data structure to hold
893 // URI + majorVersion and then we'd iterate the minor versions, look up the
894 // associated QQmlType objects by uri/elementName/major/minor and qmlunregister
895 // each of them.
896 Q_UNREACHABLE();
897 break;
898 }
899}
900
902 const char *key)
903{
904 QList<QTypeRevision> revisions;
905 for (int index = indexOfOwnClassInfo(metaObject, key); index != -1;
907 revisions.push_back(QTypeRevision::fromEncodedVersion(
908 QLatin1StringView(metaObject->classInfo(index).value()).toInt()));
909 }
910 return revisions;
911}
912
914 const char *uri, int versionMajor, int versionMinor,
915 const char *qmlName, const QString &message)
916{
917 return qmlRegisterUncreatableType<QQmlTypeNotAvailable>(
918 uri, versionMajor, versionMinor, qmlName, message);
919}
920
921namespace QQmlPrivate {
922template<>
924 const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject,
925 QVector<int> *qmlTypeIds, const QMetaObject *extension, bool)
926{
927 using T = QQmlTypeNotAvailable;
928
930 3,
933 0,
934 nullptr,
935 nullptr,
936 nullptr,
937
938 uri,
940
941 &QQmlTypeNotAvailable::staticMetaObject,
942 classInfoMetaObject,
943
944 attachedPropertiesFunc<T>(),
945 attachedPropertiesMetaObject<T>(),
946
950
951 nullptr,
952 extension,
953 qmlCreateCustomParser<T>,
954 qmlTypeIds,
956 false,
958 };
959
961}
962
968
973
975{
976 QQmlEngine *engine = aotContext->qmlEngine();
977 return engine ? QQmlEnginePrivate::get(aotContext->qmlEngine())->propertyCapture : nullptr;
978}
979
985
987{
988 if (auto *frame = engine->handle()->currentStackFrame)
989 frame->instructionPointer = offset;
990}
991
993{
994 if (auto *frame = engine->handle()->currentStackFrame) {
995 Q_ASSERT(frame->isMetaTypesFrame());
997 }
998}
999
1001 QObject *object, int coreIndex, int notifyIndex, bool isConstant,
1002 const AOTCompiledContext *aotContext)
1003{
1004 if (isConstant)
1005 return;
1006
1007 if (QQmlPropertyCapture *capture = propertyCapture(aotContext))
1008 capture->captureProperty(object, coreIndex, notifyIndex);
1009}
1010
1012 QObject *object, const QQmlPropertyCache *propertyCache,
1013 const QQmlPropertyData *property, const AOTCompiledContext *aotContext)
1014{
1015 if (property->isConstant())
1016 return;
1017
1018 if (QQmlPropertyCapture *capture = propertyCapture(aotContext))
1019 capture->captureProperty(object, propertyCache, property);
1020}
1021
1022static bool inherits(const QQmlPropertyCache *descendent, const QQmlPropertyCache *ancestor)
1023{
1024 for (const QQmlPropertyCache *cache = descendent; cache; cache = cache->parent().data()) {
1025 if (cache == ancestor)
1026 return true;
1027 }
1028 return false;
1029}
1030
1032
1038
1039template<bool StrictType>
1041{
1042 QQmlData *qmlData = QQmlData::get(object);
1043 if (!qmlData)
1044 return {qmlData, ObjectPropertyResult::NeedsInit};
1045 if (qmlData->isQueuedForDeletion)
1046 return {qmlData, ObjectPropertyResult::Deleted};
1048 const QQmlPropertyCache *propertyCache = l->qobjectLookup.propertyCache;
1049 if (StrictType) {
1050 if (qmlData->propertyCache.data() != propertyCache)
1051 return {qmlData, ObjectPropertyResult::NeedsInit};
1052 } else if (!inherits(qmlData->propertyCache.data(), propertyCache)) {
1053 return {qmlData, ObjectPropertyResult::NeedsInit};
1054 }
1055 return {qmlData, ObjectPropertyResult::OK};
1056}
1057
1058template<bool StrictType = false>
1060 QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
1061{
1062 const ObjectPropertyQmlData data = findObjectPropertyQmlData<StrictType>(l, object);
1063 if (data.result != ObjectPropertyResult::OK)
1064 return data.result;
1065
1066 const QQmlPropertyData *propertyData = l->qobjectLookup.propertyData;
1067 const int coreIndex = propertyData->coreIndex();
1068 if (data.qmlData->hasPendingBindingBit(coreIndex))
1069 data.qmlData->flushPendingBinding(coreIndex);
1070
1071 captureObjectProperty(object, l->qobjectLookup.propertyCache, propertyData, aotContext);
1072 propertyData->readProperty(object, target);
1074}
1075
1076template<bool StrictType = false>
1078{
1079 const ObjectPropertyQmlData data = findObjectPropertyQmlData<StrictType>(l, object);
1080 if (data.result != ObjectPropertyResult::OK)
1081 return data.result;
1082
1083 l->qobjectLookup.propertyData->writeProperty(object, source, {});
1085}
1086
1093
1095{
1096 QQmlData *qmlData = QQmlData::get(object);
1097 if (qmlData && qmlData->isQueuedForDeletion)
1098 return {qmlData, nullptr, ObjectPropertyResult::Deleted};
1099
1101
1102 const QMetaObject *metaObject
1103 = reinterpret_cast<const QMetaObject *>(l->qobjectFallbackLookup.metaObject - 1);
1104 if (!metaObject || metaObject != object->metaObject())
1105 return {qmlData, nullptr, ObjectPropertyResult::NeedsInit};
1106
1107 return {qmlData, metaObject, ObjectPropertyResult::OK};
1108}
1109
1111 QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
1112{
1114 if (data.result != ObjectPropertyResult::OK)
1115 return data.result;
1116
1117 const int coreIndex = l->qobjectFallbackLookup.coreIndex;
1118 if (data.qmlData && data.qmlData->hasPendingBindingBit(coreIndex))
1119 data.qmlData->flushPendingBinding(coreIndex);
1120
1121 captureFallbackProperty(object, coreIndex, l->qobjectFallbackLookup.notifyIndex,
1122 l->qobjectFallbackLookup.isConstant, aotContext);
1123
1124 void *a[] = { target, nullptr };
1125 data.metaObject->metacall(object, QMetaObject::ReadProperty, coreIndex, a);
1126
1128}
1129
1131{
1133 if (data.result != ObjectPropertyResult::OK)
1134 return data.result;
1135
1136 void *a[] = { source, nullptr };
1137 data.metaObject->metacall(
1138 object, QMetaObject::WriteProperty, l->qobjectFallbackLookup.coreIndex, a);
1139
1141}
1142
1144 QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
1145{
1146 QVariant *variant = static_cast<QVariant *>(target);
1147 const QMetaType propType = l->qobjectLookup.propertyData->propType();
1148 if (propType == QMetaType::fromType<QVariant>())
1149 return loadObjectProperty<true>(l, object, variant, aotContext);
1150
1151 *variant = QVariant(propType);
1152 return loadObjectProperty<true>(l, object, variant->data(), aotContext);
1153}
1154
1156{
1157 QVariant *variant = static_cast<QVariant *>(source);
1158 const QMetaType propType = l->qobjectLookup.propertyData->propType();
1159 if (propType == QMetaType::fromType<QVariant>())
1160 return writeBackObjectProperty<true>(l, object, variant);
1161
1162 Q_ASSERT(variant->metaType() == propType);
1163 return writeBackObjectProperty<true>(l, object, variant->data());
1164}
1165
1167 QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
1168{
1169 const QMetaObject *metaObject
1170 = reinterpret_cast<const QMetaObject *>(l->qobjectFallbackLookup.metaObject - 1);
1172
1173 QVariant *variant = static_cast<QVariant *>(target);
1174 const QMetaType propType = metaObject->property(l->qobjectFallbackLookup.coreIndex).metaType();
1175 if (propType == QMetaType::fromType<QVariant>())
1176 return loadFallbackProperty(l, object, variant, aotContext);
1177
1178 *variant = QVariant(propType);
1179 return loadFallbackProperty(l, object, variant->data(), aotContext);
1180}
1181
1183{
1184 const QMetaObject *metaObject
1185 = reinterpret_cast<const QMetaObject *>(l->qobjectFallbackLookup.metaObject - 1);
1187
1188 QVariant *variant = static_cast<QVariant *>(source);
1189 const QMetaType propType = metaObject->property(l->qobjectFallbackLookup.coreIndex).metaType();
1190 if (propType == QMetaType::fromType<QVariant>())
1191 return writeBackFallbackProperty(l, object, variant);
1192
1193 Q_ASSERT(variant->metaType() == propType);
1194 return writeBackFallbackProperty(l, object, variant->data());
1195}
1196
1197template<bool StrictType, typename Op>
1199{
1200 const ObjectPropertyQmlData data = findObjectPropertyQmlData<StrictType>(l, object);
1201 if (data.result != ObjectPropertyResult::OK)
1202 return data.result;
1203
1204 const QQmlPropertyData *property = l->qobjectLookup.propertyData;
1206 op(property);
1208}
1209
1210template<bool StrictType = false>
1212 QV4::Lookup *l, QObject *object, QV4::ExecutionEngine *v4)
1213{
1214 return changeObjectProperty<StrictType>(l, object, [&](const QQmlPropertyData *property) {
1215 if (property->isResettable()) {
1216 property->resetProperty(object, {});
1217 } else {
1218 v4->throwError(
1219 QLatin1String("Cannot assign [undefined] to ") +
1220 QLatin1String(property->propType().name()));
1221 }
1222 });
1223}
1224
1225template<bool StrictType = false>
1227{
1228 return changeObjectProperty<StrictType>(l, object, [&](const QQmlPropertyData *property) {
1229 property->writeProperty(object, value, {});
1230 });
1231}
1232
1233template<typename Op>
1235{
1237 if (data.result != ObjectPropertyResult::OK)
1238 return data.result;
1239
1240 const int coreIndex = l->qobjectFallbackLookup.coreIndex;
1242
1243 op(data.metaObject, coreIndex);
1244 return ObjectPropertyResult::OK;
1245}
1246
1248{
1249 return changeFallbackProperty(l, object, [&](const QMetaObject *metaObject, int coreIndex) {
1250 void *args[] = { value, nullptr };
1251 metaObject->metacall(object, QMetaObject::WriteProperty, coreIndex, args);
1252 });
1253}
1254
1257{
1258 return changeFallbackProperty(l, object, [&](const QMetaObject *metaObject, int coreIndex) {
1259 if (property->isResettable()) {
1260 void *args[] = { nullptr };
1261 metaObject->metacall(object, QMetaObject::ResetProperty, coreIndex, args);
1262 } else {
1263 v4->throwError(
1264 QLatin1String("Cannot assign [undefined] to ") +
1265 QLatin1String(property->typeName()));
1266 }
1267 });
1268}
1269
1270static bool isTypeCompatible(QMetaType lookupType, QMetaType propertyType)
1271{
1272 if (!lookupType.isValid()) {
1273 // If type is invalid, then the calling code depends on the lookup
1274 // to be set up in order to query the type, via lookupResultMetaType.
1275 // We cannot verify the type in this case.
1276 } else if ((lookupType.flags() & QMetaType::IsQmlList)
1277 && (propertyType.flags() & QMetaType::IsQmlList)) {
1278 // We want to check the value types here, but we cannot easily do it.
1279 // Internally those are all QObject* lists, though.
1280 } else if (lookupType.flags() & QMetaType::PointerToQObject) {
1281 // We accept any base class as type, too
1282
1283 const QMetaObject *typeMetaObject = lookupType.metaObject();
1284 const QMetaObject *foundMetaObject = propertyType.metaObject();
1285 if (!foundMetaObject)
1286 foundMetaObject = QQmlMetaType::metaObjectForType(propertyType).metaObject();
1287
1288 while (foundMetaObject && foundMetaObject != typeMetaObject)
1289 foundMetaObject = foundMetaObject->superClass();
1290
1291 if (!foundMetaObject)
1292 return false;
1293 } else if (propertyType.flags() & QMetaType::IsEnumeration) {
1294 if (propertyType == lookupType)
1295 return true;
1296
1297 // You can pass the underlying type of an enum.
1298 // We don't want to check for the actual underlying type because
1299 // moc and qmltyperegistrar are not very precise about it. Especially
1300 // the long and longlong types can be ambiguous.
1301
1302 const bool isUnsigned = propertyType.flags() & QMetaType::IsUnsignedEnumeration;
1303 switch (propertyType.sizeOf()) {
1304 case 1:
1305 return isUnsigned
1306 ? lookupType == QMetaType::fromType<quint8>()
1307 : lookupType == QMetaType::fromType<qint8>();
1308 case 2:
1309 return isUnsigned
1310 ? lookupType == QMetaType::fromType<ushort>()
1311 : lookupType == QMetaType::fromType<short>();
1312 case 4:
1313 // The default type, if moc doesn't know the actual enum type, is int.
1314 // However, the compiler can still decide to encode the enum in uint.
1315 // Therefore, we also accept int for uint enums.
1316 // TODO: This is technically UB.
1317 return isUnsigned
1318 ? (lookupType == QMetaType::fromType<int>()
1319 || lookupType == QMetaType::fromType<uint>())
1320 : lookupType == QMetaType::fromType<int>();
1321 case 8:
1322 return isUnsigned
1323 ? lookupType == QMetaType::fromType<qulonglong>()
1324 : lookupType == QMetaType::fromType<qlonglong>();
1325 }
1326
1327 return false;
1328 } else if (propertyType != lookupType) {
1329 return false;
1330 }
1331 return true;
1332}
1333
1335 QV4::ExecutionEngine *v4, QV4::Lookup *l, QObject *object, void *value)
1336{
1337 QVariant *variant = static_cast<QVariant *>(value);
1338 const QMetaType propType = l->qobjectLookup.propertyData->propType();
1339 if (propType == QMetaType::fromType<QVariant>())
1340 return storeObjectProperty<true>(l, object, variant);
1341
1342 if (!variant->isValid())
1343 return resetObjectProperty<true>(l, object, v4);
1344
1345 if (isTypeCompatible(variant->metaType(), propType))
1346 return storeObjectProperty<true>(l, object, variant->data());
1347
1348 QVariant converted(propType);
1349 v4->metaTypeFromJS(v4->fromVariant(*variant), propType, converted.data());
1350 return storeObjectProperty<true>(l, object, converted.data());
1351}
1352
1354 QV4::ExecutionEngine *v4, QV4::Lookup *l, QObject *object, void *value)
1355{
1356 QVariant *variant = static_cast<QVariant *>(value);
1357
1358 const QMetaObject *metaObject
1359 = reinterpret_cast<const QMetaObject *>(l->qobjectFallbackLookup.metaObject - 1);
1361
1362 const QMetaProperty property = metaObject->property(l->qobjectFallbackLookup.coreIndex);
1363 const QMetaType propType = property.metaType();
1364 if (propType == QMetaType::fromType<QVariant>())
1365 return storeFallbackProperty(l, object, variant);
1366
1367 if (!variant->isValid())
1368 return resetFallbackProperty(l, object, &property, v4);
1369
1370 if (isTypeCompatible(variant->metaType(), propType))
1371 return storeFallbackProperty(l, object, variant->data());
1372
1373 QVariant converted(propType);
1374 v4->metaTypeFromJS(v4->fromVariant(*variant), propType, converted.data());
1375 return storeFallbackProperty(l, object, converted.data());
1376}
1377
1379 Failure,
1380 Object,
1381 Fallback,
1384};
1385
1387 const AOTCompiledContext *aotContext, QV4::Lookup *l, QObject *object, QMetaType type)
1388{
1389 QV4::Scope scope(aotContext->engine->handle());
1391 aotContext->compilationUnit->runtimeStrings[l->nameIndex]);
1392
1393 Q_ASSERT(id.isString());
1394
1395 QV4::ScopedString name(scope, id.asStringOrSymbol());
1396
1397 Q_ASSERT(!name->equals(scope.engine->id_toString()));
1398 Q_ASSERT(!name->equals(scope.engine->id_destroy()));
1399
1400 QQmlData *ddata = QQmlData::get(object, true);
1401 Q_ASSERT(ddata);
1402 if (ddata->isQueuedForDeletion)
1403 return ObjectLookupResult::Failure;
1404
1406 if (!ddata->propertyCache) {
1407 property = QQmlPropertyCache::property(object, name, aotContext->qmlContext, nullptr);
1408 } else {
1409 property = ddata->propertyCache->property(
1410 name.getPointer(), object, aotContext->qmlContext);
1411 }
1412
1413 const bool doVariantLookup = type == QMetaType::fromType<QVariant>();
1414 if (!property) {
1415 const QMetaObject *metaObject = object->metaObject();
1416 if (!metaObject)
1417 return ObjectLookupResult::Failure;
1418
1419 const int coreIndex = metaObject->indexOfProperty(
1420 name->toQStringNoThrow().toUtf8().constData());
1421 if (coreIndex < 0)
1422 return ObjectLookupResult::Failure;
1423
1424 const QMetaProperty property = metaObject->property(coreIndex);
1425 if (!doVariantLookup && !isTypeCompatible(type, property.metaType()))
1426 return ObjectLookupResult::Failure;
1427
1429 // & 1 to tell the gc that this is not heap allocated; see markObjects in qv4lookup_p.h
1430 l->qobjectFallbackLookup.metaObject = quintptr(metaObject) + 1;
1431 l->qobjectFallbackLookup.coreIndex = coreIndex;
1432 l->qobjectFallbackLookup.notifyIndex =
1434 l->qobjectFallbackLookup.isConstant = property.isConstant() ? 1 : 0;
1435 return doVariantLookup
1436 ? ObjectLookupResult::FallbackAsVariant
1437 : ObjectLookupResult::Fallback;
1438 }
1439
1440 if (!doVariantLookup && !isTypeCompatible(type, property->propType()))
1441 return ObjectLookupResult::Failure;
1442
1443 Q_ASSERT(ddata->propertyCache);
1444
1446
1447 return doVariantLookup
1448 ? ObjectLookupResult::ObjectAsVariant
1449 : ObjectLookupResult::Object;
1450}
1451
1454{
1456 const QByteArray name = compilationUnit->runtimeStrings[l->nameIndex]->toQString().toUtf8();
1457 const int coreIndex = metaObject->indexOfProperty(name.constData());
1458 QMetaType lookupType = metaObject->property(coreIndex).metaType();
1459 if (!isTypeCompatible(type, lookupType))
1460 return false;
1461 l->qgadgetLookup.metaObject = quintptr(metaObject) + 1;
1462 l->qgadgetLookup.coreIndex = coreIndex;
1463 l->qgadgetLookup.metaType = lookupType.iface();
1464 return true;
1465}
1466
1468{
1469 const int missingLineNumber = engine->currentStackFrame->missingLineNumber();
1470 const int lineNumber = engine->currentStackFrame->lineNumber();
1471 Q_ASSERT(missingLineNumber != lineNumber);
1472
1473 auto amendStackTrace = [&](QV4::StackTrace *stackTrace) {
1474 for (auto it = stackTrace->begin(), end = stackTrace->end(); it != end; ++it) {
1475 if (it->line == missingLineNumber) {
1476 it->line = lineNumber;
1477 break;
1478 }
1479 }
1480 };
1481
1482 amendStackTrace(&engine->exceptionStackTrace);
1483
1484 QV4::Scope scope(engine);
1485 QV4::Scoped<QV4::ErrorObject> error(scope, *engine->exceptionValue);
1486 if (error) // else some other value was thrown
1487 amendStackTrace(error->d()->stackTrace);
1488}
1489
1490
1491bool AOTCompiledContext::captureLookup(uint index, QObject *object) const
1492{
1493 if (!object)
1494 return false;
1495
1496 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1500 const QQmlPropertyData *property = l->qobjectLookup.propertyData;
1501 QQmlData::flushPendingBinding(object, property->coreIndex());
1502 captureObjectProperty(object, l->qobjectLookup.propertyCache, property, this);
1503 return true;
1504 }
1505
1508 const int coreIndex = l->qobjectFallbackLookup.coreIndex;
1509 QQmlData::flushPendingBinding(object, coreIndex);
1511 object, coreIndex, l->qobjectFallbackLookup.notifyIndex,
1512 l->qobjectFallbackLookup.isConstant, this);
1513 return true;
1514 }
1515
1516 return false;
1517}
1518
1519bool AOTCompiledContext::captureQmlContextPropertyLookup(uint index) const
1520{
1521 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1524 const QQmlPropertyData *property = l->qobjectLookup.propertyData;
1525 QQmlData::flushPendingBinding(qmlScopeObject, property->coreIndex());
1526 captureObjectProperty(qmlScopeObject, l->qobjectLookup.propertyCache, property, this);
1527 return true;
1528 }
1529
1531 const int coreIndex = l->qobjectFallbackLookup.coreIndex;
1532 QQmlData::flushPendingBinding(qmlScopeObject, coreIndex);
1533 captureFallbackProperty(qmlScopeObject, coreIndex, l->qobjectFallbackLookup.notifyIndex,
1534 l->qobjectFallbackLookup.isConstant, this);
1535 return true;
1536 }
1537
1538 return false;
1539}
1540
1541void AOTCompiledContext::captureTranslation() const
1542{
1543 if (QQmlPropertyCapture *capture = propertyCapture(this))
1544 capture->captureTranslation();
1545}
1546
1547QString AOTCompiledContext::translationContext() const
1548{
1549#if QT_CONFIG(translation)
1550 return QV4::GlobalExtensions::currentTranslationContext(engine->handle());
1551#else
1552 return QString();
1553#endif
1554}
1555
1556QMetaType AOTCompiledContext::lookupResultMetaType(uint index) const
1557{
1558 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1566 return l->qobjectLookup.propertyData->propType();
1568 return QMetaType(l->qgadgetLookup.metaType);
1570 return QMetaType::fromType<int>();
1575 return QMetaType::fromType<QObject *>();
1576 } else if (l->getter == QV4::Lookup::getterFallback
1582 const QMetaObject *metaObject
1583 = reinterpret_cast<const QMetaObject *>(l->qobjectFallbackLookup.metaObject - 1);
1584 const int coreIndex = l->qobjectFallbackLookup.coreIndex;
1585 return metaObject->property(coreIndex).metaType();
1586 }
1587 return QMetaType();
1588}
1589
1590static bool isUndefined(const void *value, QMetaType type)
1591{
1592 if (type == QMetaType::fromType<QVariant>())
1593 return !static_cast<const QVariant *>(value)->isValid();
1594 if (type == QMetaType::fromType<QJSValue>())
1595 return static_cast<const QJSValue *>(value)->isUndefined();
1596 if (type == QMetaType::fromType<QJSPrimitiveValue>()) {
1597 return static_cast<const QJSPrimitiveValue *>(value)->type()
1599 }
1600 return false;
1601}
1602
1603void AOTCompiledContext::storeNameSloppy(uint nameIndex, void *value, QMetaType type) const
1604{
1605 // We don't really use any part of the lookup machinery here.
1606 // The QV4::Lookup is created on the stack to conveniently get the property cache, and through
1607 // the property cache we store a value into the property.
1608
1609 QV4::Lookup l;
1610 memset(&l, 0, sizeof(QV4::Lookup));
1611 l.nameIndex = nameIndex;
1612 l.forCall = false;
1613 ObjectPropertyResult storeResult = ObjectPropertyResult::NeedsInit;
1614 switch (initObjectLookup(this, &l, qmlScopeObject, QMetaType())) {
1615 case ObjectLookupResult::ObjectAsVariant:
1616 case ObjectLookupResult::Object: {
1617 const QMetaType propType = l.qobjectLookup.propertyData->propType();
1618 if (isTypeCompatible(type, propType)) {
1619 storeResult = storeObjectProperty(&l, qmlScopeObject, value);
1620 } else if (isUndefined(value, type)) {
1621 storeResult = resetObjectProperty(&l, qmlScopeObject, engine->handle());
1622 } else {
1623 QVariant var(propType);
1625 v4->metaTypeFromJS(v4->metaTypeToJS(type, value), propType, var.data());
1626 storeResult = storeObjectProperty(&l, qmlScopeObject, var.data());
1627 }
1628
1629 l.qobjectLookup.propertyCache->release();
1630 break;
1631 }
1632 case ObjectLookupResult::FallbackAsVariant:
1633 case ObjectLookupResult::Fallback: {
1634 const QMetaObject *metaObject
1635 = reinterpret_cast<const QMetaObject *>(l.qobjectFallbackLookup.metaObject - 1);
1636 const QMetaProperty property = metaObject->property(l.qobjectFallbackLookup.coreIndex);
1637 const QMetaType propType = property.metaType();
1638 if (isTypeCompatible(type, propType)) {
1639 storeResult = storeFallbackProperty(&l, qmlScopeObject, value);
1640 } else if (isUndefined(value, type)) {
1641 storeResult = resetFallbackProperty(&l, qmlScopeObject, &property, engine->handle());
1642 } else {
1643 QVariant var(propType);
1645 v4->metaTypeFromJS(v4->metaTypeToJS(type, value), propType, var.data());
1646 storeResult = storeFallbackProperty(&l, qmlScopeObject, var.data());
1647 }
1648 break;
1649 }
1650 case ObjectLookupResult::Failure:
1652 return;
1653 }
1654
1655 switch (storeResult) {
1656 case ObjectPropertyResult::NeedsInit:
1658 break;
1659 case ObjectPropertyResult::Deleted:
1661 QStringLiteral("Value is null and could not be converted to an object"));
1662 break;
1663 case ObjectPropertyResult::OK:
1664 break;
1665 }
1666}
1667
1668QJSValue AOTCompiledContext::javaScriptGlobalProperty(uint nameIndex) const
1669{
1670 QV4::Scope scope(engine->handle());
1671 QV4::ScopedString name(scope, compilationUnit->runtimeStrings[nameIndex]);
1673 return QJSValuePrivate::fromReturnedValue(global->get(name->toPropertyKey()));
1674}
1675
1676const QLoggingCategory *AOTCompiledContext::resolveLoggingCategory(QObject *wrapper, bool *ok) const
1677{
1678 if (wrapper) {
1679 // We have to check this here because you may pass a plain QObject that only
1680 // turns out to be a QQmlLoggingCategory at run time.
1681 if (QQmlLoggingCategory *qQmlLoggingCategory
1682 = qobject_cast<QQmlLoggingCategory *>(wrapper)) {
1683 QLoggingCategory *loggingCategory = qQmlLoggingCategory->category();
1684 *ok = true;
1685 if (!loggingCategory) {
1687 QStringLiteral("A QmlLoggingCatgory was provided without a valid name"));
1688 }
1689 return loggingCategory;
1690 }
1691 }
1692
1693 *ok = false;
1694 return qmlEngine() ? &lcQml() : &lcJs();
1695}
1696
1697void AOTCompiledContext::writeToConsole(
1698 QtMsgType type, const QString &message, const QLoggingCategory *loggingCategory) const
1699{
1700 Q_ASSERT(loggingCategory->isEnabled(type));
1701
1703 Q_ASSERT(frame);
1704
1705 const QByteArray source(frame->source().toUtf8());
1706 const QByteArray function(frame->function().toUtf8());
1707 QMessageLogger logger(source.constData(), frame->lineNumber(),
1708 function.constData(), loggingCategory->categoryName());
1709
1710 switch (type) {
1711 case QtDebugMsg:
1712 logger.debug("%s", qUtf8Printable(message));
1713 break;
1714 case QtInfoMsg:
1715 logger.info("%s", qUtf8Printable(message));
1716 break;
1717 case QtWarningMsg:
1718 logger.warning("%s", qUtf8Printable(message));
1719 break;
1720 case QtCriticalMsg:
1721 logger.critical("%s", qUtf8Printable(message));
1722 break;
1723 default:
1724 break;
1725 }
1726}
1727
1728QVariant AOTCompiledContext::constructValueType(
1729 QMetaType resultMetaType, const QMetaObject *resultMetaObject,
1730 int ctorIndex, void *ctorArg) const
1731{
1733 resultMetaType, resultMetaObject, ctorIndex, ctorArg);
1734}
1735
1736QDateTime AOTCompiledContext::constructDateTime(double timestamp) const
1737{
1738 return QV4::DateObject::timestampToDateTime(timestamp);
1739}
1740
1741QDateTime AOTCompiledContext::constructDateTime(const QString &string) const
1742{
1744}
1745
1746QDateTime AOTCompiledContext::constructDateTime(
1747 double year, double month, double day, double hours,
1748 double minutes, double seconds, double msecs) const
1749{
1750 return constructDateTime(QV4::DateObject::componentsToTimestamp(
1751 year, month, day, hours, minutes, seconds, msecs, engine->handle()));
1752}
1753
1754bool AOTCompiledContext::callQmlContextPropertyLookup(
1755 uint index, void **args, const QMetaType *types, int argc) const
1756{
1757 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1758 QV4::Scope scope(engine->handle());
1759 QV4::ScopedValue thisObject(scope);
1761 scope, l->qmlContextPropertyGetter(l, scope.engine, thisObject));
1762 if (!function) {
1763 scope.engine->throwTypeError(
1764 QStringLiteral("Property '%1' of object [null] is not a function").arg(
1765 compilationUnit->runtimeStrings[l->nameIndex]->toQString()));
1766 return false;
1767 }
1768
1769 function->call(qmlScopeObject, args, types, argc);
1770 return !scope.hasException();
1771}
1772
1773void AOTCompiledContext::initCallQmlContextPropertyLookup(uint index) const
1774{
1775 Q_UNUSED(index);
1778}
1779
1780bool AOTCompiledContext::loadContextIdLookup(uint index, void *target) const
1781{
1782 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1783 int objectId = -1;
1784 QQmlContextData *context = nullptr;
1786
1788 objectId = l->qmlContextIdObjectLookup.objectId;
1790 } else if (l->qmlContextPropertyGetter
1792 QV4::Scope scope(engine->handle());
1793 QV4::ScopedString name(scope, compilationUnit->runtimeStrings[l->nameIndex]);
1794 for (context = qmlContext; context; context = context->parent().data()) {
1795 objectId = context->propertyIndex(name);
1796 if (objectId != -1 && objectId < context->numIdValues())
1797 break;
1798 }
1799 } else {
1800 return false;
1801 }
1802
1803 Q_ASSERT(objectId >= 0);
1804 Q_ASSERT(context != nullptr);
1806 if (QQmlPropertyCapture *capture = engine->propertyCapture)
1807 capture->captureProperty(context->idValueBindings(objectId));
1808 *static_cast<QObject **>(target) = context->idValue(objectId);
1809 return true;
1810}
1811
1812void AOTCompiledContext::initLoadContextIdLookup(uint index) const
1813{
1815 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1816 QV4::Scope scope(engine->handle());
1817 QV4::ScopedString name(scope, compilationUnit->runtimeStrings[l->nameIndex]);
1818 const QQmlRefPointer<QQmlContextData> ownContext = qmlContext;
1819 for (auto context = ownContext; context; context = context->parent()) {
1820 const int propertyIdx = context->propertyIndex(name);
1821 if (propertyIdx == -1 || propertyIdx >= context->numIdValues())
1822 continue;
1823
1824 if (context.data() == ownContext.data()) {
1825 l->qmlContextIdObjectLookup.objectId = propertyIdx;
1827 } else {
1829 }
1830
1831 return;
1832 }
1833
1834 Q_UNREACHABLE();
1835}
1836
1837bool AOTCompiledContext::callObjectPropertyLookup(
1838 uint index, QObject *object, void **args, const QMetaType *types, int argc) const
1839{
1840 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1841 QV4::Scope scope(engine->handle());
1842 QV4::ScopedValue thisObject(scope, QV4::QObjectWrapper::wrap(scope.engine, object));
1843 QV4::ScopedFunctionObject function(scope, l->getter(l, engine->handle(), thisObject));
1844 if (!function) {
1845 scope.engine->throwTypeError(
1846 QStringLiteral("Property '%1' of object [object Object] is not a function")
1847 .arg(compilationUnit->runtimeStrings[l->nameIndex]->toQString()));
1848 return false;
1849 }
1850
1851 function->call(object, args, types, argc);
1852 return !scope.hasException();
1853}
1854
1855void AOTCompiledContext::initCallObjectPropertyLookup(uint index) const
1856{
1857 Q_UNUSED(index);
1860}
1861
1862bool AOTCompiledContext::callGlobalLookup(
1863 uint index, void **args, const QMetaType *types, int argc) const
1864{
1865 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1866 QV4::Scope scope(engine->handle());
1868 if (!function) {
1869 scope.engine->throwTypeError(
1870 QStringLiteral("Property '%1' of object [null] is not a function")
1871 .arg(compilationUnit->runtimeStrings[l->nameIndex]->toQString()));
1872 return false;
1873 }
1874
1875 function->call(nullptr, args, types, argc);
1876 return true;
1877}
1878
1879void AOTCompiledContext::initCallGlobalLookup(uint index) const
1880{
1881 Q_UNUSED(index);
1884}
1885
1886bool AOTCompiledContext::loadGlobalLookup(uint index, void *target, QMetaType type) const
1887{
1888 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1891 return false;
1892 }
1893 return true;
1894}
1895
1896void AOTCompiledContext::initLoadGlobalLookup(uint index) const
1897{
1898 Q_UNUSED(index);
1901}
1902
1903bool AOTCompiledContext::loadScopeObjectPropertyLookup(uint index, void *target) const
1904{
1905 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1906
1907 if (!qmlScopeObject) {
1909 compilationUnit->runtimeStrings[l->nameIndex]->toQString());
1910 return false;
1911 }
1912
1913 ObjectPropertyResult result = ObjectPropertyResult::NeedsInit;
1915 result = loadObjectProperty(l, qmlScopeObject, target, this);
1917 result = loadFallbackProperty(l, qmlScopeObject, target, this);
1918 else
1919 return false;
1920
1921 switch (result) {
1922 case ObjectPropertyResult::NeedsInit:
1923 return false;
1924 case ObjectPropertyResult::Deleted:
1926 QStringLiteral("Cannot read property '%1' of null")
1927 .arg(compilationUnit->runtimeStrings[l->nameIndex]->toQString()));
1928 return false;
1929 case ObjectPropertyResult::OK:
1930 return true;
1931 }
1932
1933 Q_UNREACHABLE_RETURN(false);
1934}
1935
1936bool AOTCompiledContext::writeBackScopeObjectPropertyLookup(uint index, void *source) const
1937{
1938 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1939
1940 ObjectPropertyResult result = ObjectPropertyResult::NeedsInit;
1942 result = writeBackObjectProperty(l, qmlScopeObject, source);
1944 result = writeBackFallbackProperty(l, qmlScopeObject, source);
1945 else
1946 return false;
1947
1948 switch (result) {
1949 case ObjectPropertyResult::NeedsInit:
1950 return false;
1951 case ObjectPropertyResult::Deleted: // Silently omit the write back. Same as interpreter
1952 case ObjectPropertyResult::OK:
1953 return true;
1954 }
1955
1956 Q_UNREACHABLE_RETURN(false);
1957}
1958
1959void AOTCompiledContext::initLoadScopeObjectPropertyLookup(uint index, QMetaType type) const
1960{
1962 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1963
1964 if (v4->hasException) {
1965 amendException(v4);
1966 return;
1967 }
1968
1969 switch (initObjectLookup(this, l, qmlScopeObject, type)) {
1970 case ObjectLookupResult::ObjectAsVariant:
1971 case ObjectLookupResult::Object:
1973 break;
1974 case ObjectLookupResult::FallbackAsVariant:
1975 case ObjectLookupResult::Fallback:
1977 break;
1978 case ObjectLookupResult::Failure:
1979 v4->throwTypeError();
1980 break;
1981 }
1982}
1983
1984bool AOTCompiledContext::loadSingletonLookup(uint index, void *target) const
1985{
1986 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
1987 QV4::Scope scope(engine->handle());
1988
1991 scope, l->qmlContextSingletonLookup.singletonObject);
1992
1993 // We don't handle non-QObject singletons (as those can't be declared in qmltypes anyway)
1995 *static_cast<QObject **>(target) = wrapper->object();
1996 return true;
1997 }
1998
1999 return false;
2000}
2001
2004
2005template<QmlContextPropertyGetter qmlContextPropertyGetter>
2006static void initTypeWrapperLookup(
2007 const AOTCompiledContext *context, QV4::Lookup *l, uint importNamespace)
2008{
2009 Q_ASSERT(!context->engine->hasError());
2010 if (importNamespace != AOTCompiledContext::InvalidStringId) {
2011 QV4::Scope scope(context->engine->handle());
2012 QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]);
2013
2014 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2015 Q_ASSERT(typeLoader);
2016 if (const QQmlImportRef *importRef
2017 = context->qmlContext->imports()->query(import, typeLoader).importNamespace) {
2018
2021 scope.engine, nullptr, context->qmlContext->imports(), importRef));
2022 wrapper = l->qmlContextPropertyGetter(l, context->engine->handle(), wrapper);
2023 l->qmlContextPropertyGetter = qmlContextPropertyGetter;
2024 if (qmlContextPropertyGetter == QV4::QQmlContextWrapper::lookupSingleton)
2025 l->qmlContextSingletonLookup.singletonObject.set(scope.engine, wrapper->heapObject());
2026 else if (qmlContextPropertyGetter == QV4::QQmlContextWrapper::lookupType)
2027 l->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->heapObject());
2028 return;
2029 }
2030 scope.engine->throwTypeError();
2031 } else {
2032 QV4::ExecutionEngine *v4 = context->engine->handle();
2033 l->qmlContextPropertyGetter(l, v4, nullptr);
2034 if (l->qmlContextPropertyGetter != qmlContextPropertyGetter) {
2035 const QString error
2036 = QLatin1String(qmlContextPropertyGetter
2038 ? "%1 was a singleton at compile time, "
2039 "but is not a singleton anymore."
2040 : "%1 was not a singleton at compile time, "
2041 "but is a singleton now.")
2042 .arg(context->compilationUnit->runtimeStrings[l->nameIndex]->toQString());
2043 v4->throwTypeError(error);
2044 }
2045 }
2046}
2048void AOTCompiledContext::initLoadSingletonLookup(uint index, uint importNamespace) const
2049{
2050 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2051 initTypeWrapperLookup<QV4::QQmlContextWrapper::lookupSingleton>(this, l, importNamespace);
2052}
2054bool AOTCompiledContext::loadAttachedLookup(uint index, QObject *object, void *target) const
2055{
2056 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2058 return false;
2059
2060 QV4::Scope scope(engine->handle());
2063 *static_cast<QObject **>(target) = qmlAttachedPropertiesObject(
2064 object, wrapper->d()->type().attachedPropertiesFunction(
2066 return true;
2067}
2069void AOTCompiledContext::initLoadAttachedLookup(
2070 uint index, uint importNamespace, QObject *object) const
2071{
2072 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2073 QV4::Scope scope(engine->handle());
2074 QV4::ScopedString name(scope, compilationUnit->runtimeStrings[l->nameIndex]);
2075
2076 QQmlType type;
2077 QQmlTypeLoader *typeLoader = scope.engine->typeLoader();
2078 Q_ASSERT(typeLoader);
2079 if (importNamespace != InvalidStringId) {
2080 QV4::ScopedString import(scope, compilationUnit->runtimeStrings[importNamespace]);
2081 if (const QQmlImportRef *importRef
2082 = qmlContext->imports()->query(import, typeLoader).importNamespace) {
2083 type = qmlContext->imports()->query(name, importRef, typeLoader).type;
2084 }
2085 } else {
2086 type = qmlContext->imports()->query<QQmlImport::AllowRecursion>(name, typeLoader).type;
2087 }
2088
2089 if (!type.isValid()) {
2090 scope.engine->throwTypeError();
2091 return;
2092 }
2093
2095 scope, QV4::QQmlTypeWrapper::create(scope.engine, object, type,
2097
2098 l->qmlTypeLookup.qmlTypeWrapper.set(scope.engine, wrapper->d());
2100}
2102bool AOTCompiledContext::loadTypeLookup(uint index, void *target) const
2103{
2104 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2106 return false;
2107
2108 const QV4::Heap::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::Heap::QQmlTypeWrapper *>(
2109 l->qmlTypeLookup.qmlTypeWrapper.get());
2110
2111 QMetaType metaType = typeWrapper->type().typeId();
2112 *static_cast<const QMetaObject **>(target)
2113 = QQmlMetaType::metaObjectForType(metaType).metaObject();
2114 return true;
2115}
2117void AOTCompiledContext::initLoadTypeLookup(uint index, uint importNamespace) const
2118{
2119 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2120 initTypeWrapperLookup<QV4::QQmlContextWrapper::lookupType>(this, l, importNamespace);
2121}
2123bool AOTCompiledContext::getObjectLookup(uint index, QObject *object, void *target) const
2124{
2125 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2126 const auto doThrow = [&]() {
2128 QStringLiteral("Cannot read property '%1' of null")
2129 .arg(compilationUnit->runtimeStrings[l->nameIndex]->toQString()));
2130 return false;
2131 };
2132
2133 if (!object)
2134 return doThrow();
2135
2136 ObjectPropertyResult result = ObjectPropertyResult::NeedsInit;
2138 result = loadObjectProperty(l, object, target, this);
2139 else if (l->getter == QV4::Lookup::getterFallback)
2140 result = loadFallbackProperty(l, object, target, this);
2142 result = loadObjectAsVariant(l, object, target, this);
2144 result = loadFallbackAsVariant(l, object, target, this);
2145 else
2146 return false;
2147
2148 switch (result) {
2149 case ObjectPropertyResult::Deleted:
2150 return doThrow();
2151 case ObjectPropertyResult::NeedsInit:
2152 return false;
2153 case ObjectPropertyResult::OK:
2154 return true;
2155 }
2156
2157 Q_UNREACHABLE_RETURN(false);
2158}
2160bool AOTCompiledContext::writeBackObjectLookup(uint index, QObject *object, void *source) const
2161{
2162 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2163 if (!object)
2164 return true;
2165
2166 ObjectPropertyResult result = ObjectPropertyResult::NeedsInit;
2169 else if (l->getter == QV4::Lookup::getterFallback)
2175 else
2176 return false;
2177
2178 switch (result) {
2179 case ObjectPropertyResult::NeedsInit:
2180 return false;
2181 case ObjectPropertyResult::Deleted: // Silently omit the write back
2182 case ObjectPropertyResult::OK:
2183 return true;
2184 }
2185
2186 Q_UNREACHABLE_RETURN(false);
2187}
2189void AOTCompiledContext::initGetObjectLookup(uint index, QObject *object, QMetaType type) const
2190{
2192 if (v4->hasException) {
2193 amendException(v4);
2194 } else {
2195 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2196 switch (initObjectLookup(this, l, object, type)) {
2197 case ObjectLookupResult::Object:
2199 break;
2200 case ObjectLookupResult::ObjectAsVariant:
2202 break;
2203 case ObjectLookupResult::Fallback:
2205 break;
2206 case ObjectLookupResult::FallbackAsVariant:
2208 break;
2209 case ObjectLookupResult::Failure:
2211 break;
2212 }
2213 }
2214}
2216bool AOTCompiledContext::getValueLookup(uint index, void *value, void *target) const
2217{
2218 Q_ASSERT(value);
2219
2220 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2222 return false;
2223
2224 const QMetaObject *metaObject
2225 = reinterpret_cast<const QMetaObject *>(l->qgadgetLookup.metaObject - 1);
2227
2228 void *args[] = { target, nullptr };
2229 metaObject->d.static_metacall(
2230 reinterpret_cast<QObject*>(value), QMetaObject::ReadProperty,
2231 l->qgadgetLookup.coreIndex, args);
2232 return true;
2233}
2235bool AOTCompiledContext::writeBackValueLookup(uint index, void *value, void *source) const
2236{
2237 Q_ASSERT(value);
2238
2239 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2241 return false;
2242
2243 const QMetaObject *metaObject
2244 = reinterpret_cast<const QMetaObject *>(l->qgadgetLookup.metaObject - 1);
2246
2247 void *args[] = { source, nullptr };
2248 metaObject->d.static_metacall(
2249 reinterpret_cast<QObject*>(value), QMetaObject::WriteProperty,
2250 l->qgadgetLookup.coreIndex, args);
2251 return true;
2252}
2254void AOTCompiledContext::initGetValueLookup(
2256{
2258 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2259 if (initValueLookup(l, compilationUnit, metaObject, type))
2261 else
2263}
2265bool AOTCompiledContext::getEnumLookup(uint index, void *target) const
2266{
2267 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2269 return false;
2270 const bool isUnsigned
2272 const QV4::ReturnedValue encoded = l->qmlEnumValueLookup.encodedEnumValue;
2273 switch (l->qmlEnumValueLookup.metaType->size) {
2274 case 1:
2275 if (isUnsigned)
2276 *static_cast<quint8 *>(target) = encoded;
2277 else
2278 *static_cast<qint8 *>(target) = encoded;
2279 return true;
2280 case 2:
2281 if (isUnsigned)
2282 *static_cast<quint16 *>(target) = encoded;
2283 else
2284 *static_cast<qint16 *>(target) = encoded;
2285 return true;
2286 case 4:
2287 if (isUnsigned)
2288 *static_cast<quint32 *>(target) = encoded;
2289 else
2290 *static_cast<qint32 *>(target) = encoded;
2291 return true;
2292 case 8:
2293 if (isUnsigned)
2294 *static_cast<quint64 *>(target) = encoded;
2295 else
2296 *static_cast<qint64 *>(target) = encoded;
2297 return true;
2298 default:
2299 break;
2300 }
2301
2302 return false;
2303}
2305void AOTCompiledContext::initGetEnumLookup(
2307 const char *enumerator, const char *enumValue) const
2308{
2310 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2311 if (!metaObject) {
2313 QStringLiteral("Cannot read property '%1' of undefined")
2314 .arg(QString::fromUtf8(enumValue)));
2315 return;
2316 }
2317 const int enumIndex = metaObject->indexOfEnumerator(enumerator);
2318 const QMetaEnum metaEnum = metaObject->enumerator(enumIndex);
2319 l->qmlEnumValueLookup.encodedEnumValue = metaEnum.keyToValue(enumValue);
2320 l->qmlEnumValueLookup.metaType = metaEnum.metaType().iface();
2322}
2324bool AOTCompiledContext::setObjectLookup(uint index, QObject *object, void *value) const
2325{
2326 const auto doThrow = [&]() {
2328 QStringLiteral("Value is null and could not be converted to an object"));
2329 return false;
2330 };
2331
2332 if (!object)
2333 return doThrow();
2334
2335 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2336 ObjectPropertyResult result = ObjectPropertyResult::NeedsInit;
2338 result = storeObjectProperty(l, object, value);
2339 else if (l->setter == QV4::Lookup::setterFallback)
2340 result = storeFallbackProperty(l, object, value);
2342 result = storeObjectAsVariant(engine->handle(), l, object, value);
2345 else
2346 return false;
2347
2348 switch (result) {
2349 case ObjectPropertyResult::Deleted:
2350 return doThrow();
2351 case ObjectPropertyResult::NeedsInit:
2352 return false;
2353 case ObjectPropertyResult::OK:
2354 return true;
2355 }
2356
2357 Q_UNREACHABLE_RETURN(false);
2358}
2360void AOTCompiledContext::initSetObjectLookup(uint index, QObject *object, QMetaType type) const
2361{
2363 if (v4->hasException) {
2364 amendException(v4);
2365 } else {
2366 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2367 switch (initObjectLookup(this, l, object, type)) {
2368 case ObjectLookupResult::Object:
2370 break;
2371 case ObjectLookupResult::ObjectAsVariant:
2373 break;
2374 case ObjectLookupResult::Fallback:
2376 break;
2377 case ObjectLookupResult::FallbackAsVariant:
2379 break;
2380 case ObjectLookupResult::Failure:
2382 break;
2383 }
2384 }
2385}
2387bool AOTCompiledContext::setValueLookup(
2388 uint index, void *target, void *value) const
2389{
2390 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2392 return false;
2393
2394 const QMetaObject *metaObject
2395 = reinterpret_cast<const QMetaObject *>(l->qgadgetLookup.metaObject - 1);
2396
2397 void *args[] = { value, nullptr };
2398 metaObject->d.static_metacall(
2399 reinterpret_cast<QObject*>(target), QMetaObject::WriteProperty,
2400 l->qgadgetLookup.coreIndex, args);
2401 return true;
2402}
2404void AOTCompiledContext::initSetValueLookup(uint index, const QMetaObject *metaObject,
2405 QMetaType type) const
2406{
2408 QV4::Lookup *l = compilationUnit->runtimeLookups + index;
2409 if (initValueLookup(l, compilationUnit, metaObject, type))
2411 else
2413}
2414
2415} // namespace QQmlPrivate
2416
Definition main.cpp:8
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qdatetime.h:283
The QJSEngine class provides an environment for evaluating JavaScript code.
Definition qjsengine.h:26
QV4::ExecutionEngine * handle() const
Definition qjsengine.h:298
bool hasError() const
Returns true if the last JavaScript execution resulted in an exception or if throwError() was called.
static void setObjectOwnership(QObject *, ObjectOwnership)
Sets the ownership of object.
The QJSPrimitiveValue class operates on primitive types in JavaScript semantics.
static QJSValue fromReturnedValue(QV4::ReturnedValue d)
Definition qjsvalue_p.h:197
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
bool isUndefined() const
Returns true if this QJSValue is of the primitive type Undefined or if the managed value has been cle...
Definition qjsvalue.cpp:351
int toInt(bool *ok=nullptr, int base=10) const
Definition qlist.h:75
\inmodule QtCore
\inmodule QtCore
Definition qlogging.h:72
void void Q_DECL_COLD_FUNCTION void warning(const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
Logs a warning message specified with format msg.
Definition qlogging.cpp:625
void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void critical(const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
Logs a critical message specified with format msg.
Definition qlogging.cpp:727
void void void info(const QLoggingCategory &cat, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
Logs an informational message specified with format msg for the context cat.
Definition qlogging.cpp:536
void debug(const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
Logs a debug message specified with format msg.
Definition qlogging.cpp:389
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qmetaobject.h:19
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qmetatype.h:341
constexpr TypeFlags flags() const
Definition qmetatype.h:2658
const QtPrivate::QMetaTypeInterface * iface() const
Definition qmetatype.h:771
constexpr qsizetype sizeOf() const
Definition qmetatype.h:2648
bool isValid() const
@ IsUnsignedEnumeration
Definition qmetatype.h:411
@ PointerToQObject
Definition qmetatype.h:406
@ IsEnumeration
Definition qmetatype.h:407
constexpr const QMetaObject * metaObject() const
Definition qmetatype.h:2663
constexpr const char * name() const
Definition qmetatype.h:2680
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:150
\inmodule QtCore
Definition qobject.h:103
QThread * thread() const
Returns the thread in which the object lives.
Definition qobject.cpp:1598
std::vector< ConstructionState > DeferredState
static void completeDeferred(QQmlEnginePrivate *enginePriv, DeferredState *deferredState)
static void beginDeferred(QQmlEnginePrivate *enginePriv, QObject *object, DeferredState *deferredState)
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
static void flushPendingBinding(QObject *object, int coreIndex)
Definition qqmldata_p.h:413
QQmlPropertyCache::ConstPtr propertyCache
Definition qqmldata_p.h:195
static bool wasDeleted(const QObject *)
Definition qqmldata_p.h:312
static QQmlData * get(QObjectPrivate *priv, bool create)
Definition qqmldata_p.h:199
quint32 isQueuedForDeletion
Definition qqmldata_p.h:99
static bool baseModulesUninitialized
static QQmlEnginePrivate * get(QQmlEngine *e)
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
static QQmlContext * contextForObject(const QObject *)
Returns the QQmlContext for the object, or nullptr if no context has been set.
void qmlUnregisterModuleImport(const char *uri, int moduleMajor, const char *import, int importMajor, int importMinor)
Removes a module import previously registered with qmlRegisterModuleImport()
Definition qqml.cpp:348
void qmlRegisterModuleImport(const char *uri, int moduleMajor, const char *import, int importMajor, int importMinor)
Registers a qmldir-import for module uri of major version moduleMajor.
Definition qqml.cpp:328
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
static QQmlType registerSequentialContainer(const QQmlPrivate::RegisterSequentialContainer &sequenceRegistration)
static void unregisterType(int type)
static void registerUndeletableType(const QQmlType &dtype)
static void unregisterAutoParentFunction(const QQmlPrivate::AutoParentFunction &function)
static bool protectModule(const QString &uri, QTypeRevision version, bool weakProtectAllVersions=false)
static QQmlType registerCompositeSingletonType(const QQmlPrivate::RegisterCompositeSingletonType &type, const QQmlType::SingletonInstanceInfo::ConstPtr &siinfo)
static void removeCachedUnitLookupFunction(QQmlPrivate::QmlUnitCacheLookupFunction handler)
static void registerModule(const char *uri, QTypeRevision version)
static QQmlType registerInterface(const QQmlPrivate::RegisterInterface &type)
static int typeId(const char *uri, QTypeRevision version, const char *qmlName)
static QQmlType registerType(const QQmlPrivate::RegisterType &type)
static QQmlMetaObject metaObjectForType(QMetaType metaType)
static void registerModuleImport(const QString &uri, QTypeRevision version, const QQmlDirParser::Import &import)
static QQmlAttachedPropertiesFunc attachedPropertiesFunc(QQmlEnginePrivate *, const QMetaObject *)
static void registerTypeAlias(int typeId, const QString &name)
static QQmlType registerCompositeType(const QQmlPrivate::RegisterCompositeType &type)
static int registerAutoParentFunction(const QQmlPrivate::RegisterAutoParent &autoparent)
static void clearTypeRegistrations()
static QQmlPropertyCache::ConstPtr propertyCache(QObject *object, QTypeRevision version=QTypeRevision())
Returns a QQmlPropertyCache for obj if one is available.
static QQmlType registerSingletonType(const QQmlPrivate::RegisterSingletonType &type, const QQmlType::SingletonInstanceInfo::ConstPtr &siinfo)
static void unregisterSequentialContainer(int id)
static int registerUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRegistration)
static void unregisterModuleImport(const QString &uri, QTypeRevision version, const QQmlDirParser::Import &import)
const QQmlPropertyData * property(const K &key, QObject *object, const QQmlRefPointer< QQmlContextData > &context) const
void readProperty(QObject *target, void *property) const
static void removeBinding(const QQmlProperty &that)
static constexpr int extensionObjectId(int id) noexcept
T * data() const
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
static QUrl normalize(const QUrl &unNormalizedUrl)
static QQmlType compositeQmlType(const QQmlRefPointer< QV4::CompiledData::CompilationUnit > &unit, QQmlTypeLoader *typeLoader, const QString &type)
static QVariant constructValueType(QMetaType targetMetaType, const QMetaObject *targetMetaObject, int ctorIndex, void *ctorArg)
iterator begin()
Definition qset.h:136
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
QByteArray toUtf8() const &
Definition qstring.h:634
\inmodule QtCore
static constexpr QTypeRevision fromMajorVersion(Major majorVersion)
Produces a QTypeRevision from the given majorVersion with an invalid minor version.
static constexpr QTypeRevision fromVersion(Major majorVersion, Minor minorVersion)
Produces a QTypeRevision from the given majorVersion and minorVersion, both of which need to be a val...
static constexpr QTypeRevision fromMinorVersion(Minor minorVersion)
Produces a QTypeRevision from the given minorVersion with an invalid major version.
constexpr bool hasMinorVersion() const
Returns true if the minor version is known, otherwise false.
static constexpr QTypeRevision zero()
Produces a QTypeRevision with major and minor version {0}.
constexpr bool hasMajorVersion() const
Returns true if the major version is known, otherwise false.
constexpr quint8 minorVersion() const
Returns the minor version encoded in the revision.
constexpr bool isValid() const
Returns true if the major version or the minor version is known, otherwise false.
static constexpr QTypeRevision fromEncodedVersion(Integer value)
Produces a QTypeRevision from the given value.
constexpr quint8 majorVersion() const
Returns the major version encoded in the revision.
const QQmlRefPointer< QV4::CompiledData::CompilationUnit > & baseCompilationUnit() const
\inmodule QtCore
Definition qvariant.h:65
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
Definition qvariant.h:714
QMetaType metaType() const
void extension()
[6]
Definition dialogs.cpp:230
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
else opt state
[0]
static void initTypeWrapperLookup(const AOTCompiledContext *context, QV4::Lookup *l, uint importNamespace)
Definition qqml.cpp:2005
QTypeRevision revisionClassInfo(const QMetaObject *metaObject, const char *key, QTypeRevision defaultValue=QTypeRevision())
void Q_QML_EXPORT qmlunregister(RegistrationType, quintptr)
Definition qqml.cpp:869
QV4::ReturnedValue(*)(QV4::Lookup *l, QV4::ExecutionEngine *engine, QV4::Value *thisObject) QmlContextPropertyGetter
Definition qqml.cpp:2002
static FallbackPropertyQmlData findFallbackPropertyQmlData(QV4::Lookup *l, QObject *object)
Definition qqml.cpp:1094
ObjectPropertyResult loadObjectProperty(QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1059
static ObjectPropertyResult storeFallbackProperty(QV4::Lookup *l, QObject *object, void *value)
Definition qqml.cpp:1247
static int indexOfOwnClassInfo(const QMetaObject *metaObject, const char *key, int startOffset=-1)
static ObjectPropertyResult resetFallbackProperty(QV4::Lookup *l, QObject *object, const QMetaProperty *property, QV4::ExecutionEngine *v4)
Definition qqml.cpp:1255
static bool initValueLookup(QV4::Lookup *l, QV4::ExecutableCompilationUnit *compilationUnit, const QMetaObject *metaObject, QMetaType type)
Definition qqml.cpp:1452
static ObjectPropertyResult storeObjectAsVariant(QV4::ExecutionEngine *v4, QV4::Lookup *l, QObject *object, void *value)
Definition qqml.cpp:1334
ObjectPropertyResult writeBackObjectAsVariant(QV4::Lookup *l, QObject *object, void *source)
Definition qqml.cpp:1155
Q_QML_EXPORT void qmlRegistrationWarning(QmlRegistrationWarning warning, QMetaType type)
Definition qqml.cpp:153
static void captureFallbackProperty(QObject *object, int coreIndex, int notifyIndex, bool isConstant, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1000
@ CompositeSingletonRegistration
@ SingletonRegistration
@ SequentialContainerRegistration
@ SequentialContainerAndRevisionsRegistration
@ QmlUnitCacheHookRegistration
@ CompositeRegistration
@ SingletonAndRevisionsRegistration
@ InterfaceRegistration
@ AutoParentRegistration
@ TypeAndRevisionsRegistration
static ObjectPropertyResult storeFallbackAsVariant(QV4::ExecutionEngine *v4, QV4::Lookup *l, QObject *object, void *value)
Definition qqml.cpp:1353
static ObjectPropertyResult changeObjectProperty(QV4::Lookup *l, QObject *object, Op op)
Definition qqml.cpp:1198
Q_QML_EXPORT QList< QTypeRevision > revisionClassInfos(const QMetaObject *metaObject, const char *key)
Definition qqml.cpp:901
static bool inherits(const QQmlPropertyCache *descendent, const QQmlPropertyCache *ancestor)
Definition qqml.cpp:1022
ObjectPropertyQmlData findObjectPropertyQmlData(QV4::Lookup *l, QObject *object)
Definition qqml.cpp:1040
static ObjectLookupResult initObjectLookup(const AOTCompiledContext *aotContext, QV4::Lookup *l, QObject *object, QMetaType type)
Definition qqml.cpp:1386
static void captureObjectProperty(QObject *object, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *property, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1011
static bool isUndefined(const void *value, QMetaType type)
Definition qqml.cpp:1590
static void amendException(QV4::ExecutionEngine *engine)
Definition qqml.cpp:1467
@ UnconstructibleSingleton
Q_QML_EXPORT QObject * qmlExtendedObject(QObject *, int)
Definition qqml.cpp:134
ObjectPropertyResult writeBackObjectProperty(QV4::Lookup *l, QObject *object, void *source)
Definition qqml.cpp:1077
static ObjectPropertyResult loadFallbackProperty(QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1110
const CachedQmlUnit *(* QmlUnitCacheLookupFunction)(const QUrl &url)
const char * classInfo(const QMetaObject *metaObject, const char *key)
ObjectPropertyResult loadFallbackAsVariant(QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1166
ObjectPropertyResult loadObjectAsVariant(QV4::Lookup *l, QObject *object, void *target, const AOTCompiledContext *aotContext)
Definition qqml.cpp:1143
static bool isTypeCompatible(QMetaType lookupType, QMetaType propertyType)
Definition qqml.cpp:1270
bool boolClassInfo(const QMetaObject *metaObject, const char *key, bool defaultValue=false)
int Q_QML_EXPORT qmlregister(RegistrationType, void *)
Definition qqml.cpp:771
AutoParentResult(* AutoParentFunction)(QObject *object, QObject *parent)
Q_QML_EXPORT QMetaType compositeListMetaType(QV4::ExecutableCompilationUnit *unit, const QString &elementName)
Definition qqml.cpp:187
Q_QML_EXPORT QMetaType compositeMetaType(QV4::ExecutableCompilationUnit *unit, const QString &elementName)
Definition qqml.cpp:179
void qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QVector< int > *qmlTypeIds, const QMetaObject *extension, bool)
Definition qqml.cpp:923
static ObjectPropertyResult writeBackFallbackProperty(QV4::Lookup *l, QObject *object, void *source)
Definition qqml.cpp:1130
static ObjectPropertyResult resetObjectProperty(QV4::Lookup *l, QObject *object, QV4::ExecutionEngine *v4)
Definition qqml.cpp:1211
static QQmlPropertyCapture * propertyCapture(const AOTCompiledContext *aotContext)
Definition qqml.cpp:974
static ObjectPropertyResult storeObjectProperty(QV4::Lookup *l, QObject *object, void *value)
Definition qqml.cpp:1226
ObjectPropertyResult
Definition qqml.cpp:1031
ObjectPropertyResult writeBackFallbackAsVariant(QV4::Lookup *l, QObject *object, void *source)
Definition qqml.cpp:1182
static ObjectPropertyResult changeFallbackProperty(QV4::Lookup *l, QObject *object, Op op)
Definition qqml.cpp:1234
Combined button and popup list for selecting options.
Scoped< FunctionObject > ScopedFunctionObject
quint64 ReturnedValue
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
Scoped< String > ScopedString
static void * context
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QtMsgType
Definition qlogging.h:29
@ QtCriticalMsg
Definition qlogging.h:32
@ QtInfoMsg
Definition qlogging.h:34
@ QtWarningMsg
Definition qlogging.h:31
@ QtDebugMsg
Definition qlogging.h:30
#define qWarning
Definition qlogging.h:166
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint index
[2]
GLuint GLuint end
GLsizei GLenum GLenum * types
GLuint object
[3]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type
GLenum target
GLuint GLsizei const GLchar * message
GLuint start
GLenum GLuint GLintptr offset
GLuint name
GLsizei GLsizei GLchar * source
GLhandleARB obj
[2]
GLenum func
Definition qopenglext.h:663
const GLubyte * c
GLuint GLuint * names
GLuint64EXT * result
[6]
bool qmlProtectModule(const char *uri, int majVersion)
Definition qqml.cpp:238
int qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
Definition qqml.cpp:357
void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor)
Definition qqml.cpp:245
QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *object, const QMetaObject *attachedMetaObject)
Definition qqml.cpp:106
QVarLengthArray< const char *, 8 > ElementNames
Definition qqml.cpp:529
int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
Definition qqml.cpp:195
void qmlExecuteDeferred(QObject *object)
Definition qqml.cpp:49
static void doRegisterSingletonAndRevisions(const QQmlPrivate::RegisterSingletonTypeAndRevisions &type, const ElementNames &elementNames)
Definition qqml.cpp:707
static ElementNames classElementNames(const QMetaObject *metaObject)
Definition qqml.cpp:530
void assignVersions(Registration *registration, QTypeRevision revision, QTypeRevision defaultVersion)
Definition qqml.cpp:452
static int finalizeType(const QQmlType &dtype)
Definition qqml.cpp:520
QQmlEngine * qmlEngine(const QObject *obj)
Definition qqml.cpp:80
static QVector< QTypeRevision > availableRevisions(const QMetaObject *metaObject)
Definition qqml.cpp:422
int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &message)
Definition qqml.cpp:913
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
static QObject * resolveAttachedProperties(QQmlAttachedPropertiesFunc pf, QQmlData *data, QObject *object, bool create)
Definition qqml.cpp:88
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool create)
Definition qqml.cpp:114
static void uniqueRevisions(QVector< QTypeRevision > *revisions, QTypeRevision defaultVersion, QTypeRevision added)
Definition qqml.cpp:470
void qmlClearTypeRegistrations()
Definition qqml.cpp:230
static QQmlDirParser::Import resolveImport(const QString &uri, int importMajor, int importMinor)
Definition qqml.cpp:250
QObject * qmlExtendedObject(QObject *object)
Definition qqml.cpp:129
static bool checkSingletonInstance(QQmlEngine *engine, QObject *instance)
Definition qqml.cpp:362
static void doRegisterTypeAndRevisions(const QQmlPrivate::RegisterTypeAndRevisions &type, const ElementNames &elementNames)
Definition qqml.cpp:594
static QVector< QTypeRevision > prepareRevisions(const QMetaObject *metaObject, QTypeRevision added)
Definition qqml.cpp:463
static QTypeRevision resolveModuleVersion(int moduleMajor)
Definition qqml.cpp:261
static QQmlType::SingletonInstanceInfo::ConstPtr singletonInstanceInfo(const QQmlPrivate::RegisterSingletonType &type)
Definition qqml.cpp:499
@ QQmlModuleImportLatest
Definition qqml.h:649
@ QQmlModuleImportModuleAny
Definition qqml.h:648
@ QQmlModuleImportAuto
Definition qqml.h:650
void qmlClearEnginePlugins()
static const QQmlModuleRegistration registration("QtQml", qml_register_types_QtQml)
QQmlPrivate::QQmlAttachedPropertiesFunc< QObject > QQmlAttachedPropertiesFunc
Definition qqmlprivate.h:63
QDebug warning(QAnyStringView fileName, int lineNumber)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int void * arg
#define qUtf8Printable(string)
Definition qstring.h:1535
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define QStringLiteral(str)
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
short qint16
Definition qtypes.h:47
unsigned short quint16
Definition qtypes.h:48
size_t quintptr
Definition qtypes.h:167
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60
QT_BEGIN_NAMESPACE typedef signed char qint8
Definition qtypes.h:45
unsigned char quint8
Definition qtypes.h:46
const char property[13]
Definition qwizard.cpp:101
obj metaObject() -> className()
QVariant variant
[1]
QFrame frame
[0]
view create()
QJSValueList args
QJSValue global
QJSEngine engine
[0]
AliasRegistrar(const ElementNames *elementNames)
Definition qqml.cpp:574
void registerAliases(int typeId)
Definition qqml.cpp:576
static Q_CORE_EXPORT int signalIndex(const QMetaMethod &m)
\inmodule QtCore
int indexOfProperty(const char *name) const
Finds property name and returns its index; otherwise returns -1.
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or \nullptr if there is no such object.
void setInstructionPointer(int offset) const
Definition qqml.cpp:986
QJSValue jsMetaType(int index) const
Definition qqml.cpp:980
void setReturnValueUndefined() const
Definition qqml.cpp:992
QQmlEngine * qmlEngine() const
Definition qqml.cpp:969
QV4::ExecutableCompilationUnit * compilationUnit
QObject * thisObject() const
Definition qqml.cpp:963
const QMetaObject * metaObject
Definition qqml.cpp:1090
ObjectPropertyResult result
Definition qqml.cpp:1091
ObjectPropertyResult result
Definition qqml.cpp:1036
static constexpr QMetaType list()
static constexpr QMetaSequence sequence()
static constexpr QMetaType self()
QObject * operator()(QQmlEngine *, QJSEngine *)
Definition qqml.cpp:404
QQmlRefPointer< const SingletonInstanceInfo > ConstPtr
Definition qqmltype_p.h:127
QQmlRefPointer< SingletonInstanceInfo > Ptr
Definition qqmltype_p.h:126
static QDateTime timestampToDateTime(double timestamp, QTimeZone zone=QTimeZone::LocalTime)
static QDateTime stringToDateTime(const QString &string, ExecutionEngine *engine)
static double componentsToTimestamp(double year, double month, double day, double hours, double mins, double secs, double ms, ExecutionEngine *v4)
IdentifierTable * identifierTable
CppStackFrame * currentStackFrame
static bool metaTypeFromJS(const Value &value, QMetaType type, void *data)
ReturnedValue throwError(const Value &value)
ReturnedValue throwReferenceError(const Value &value)
QV4::ReturnedValue fromVariant(const QVariant &)
String * id_destroy() const
String * id_toString() const
QV4::ReturnedValue metaTypeToJS(QMetaType type, const void *data)
QQmlEngine * qmlEngine() const
TypeLoader * typeLoader()
ReturnedValue throwTypeError()
ReturnedValue asReturnedValue() const
Definition qv4value_p.h:342
QString toQString() const
Definition qv4string_p.h:92
PropertyKey asPropertyKey(const Heap::String *str)
ReturnedValue(* globalGetter)(Lookup *l, ExecutionEngine *engine)
Definition qv4lookup_p.h:41
struct QV4::Lookup::@584::@607 qmlEnumValueLookup
ReturnedValue(* qmlContextPropertyGetter)(Lookup *l, ExecutionEngine *engine, Value *thisObject)
Definition qv4lookup_p.h:42
static ReturnedValue getterQObject(Lookup *l, ExecutionEngine *engine, const Value &object)
static ReturnedValue getterQObjectAsVariant(Lookup *l, ExecutionEngine *engine, const Value &object)
static bool setterQObjectAsVariant(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value)
struct QV4::Lookup::@584::@606 qmlTypeLookup
static bool setterQObject(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value)
ReturnedValue(* getter)(Lookup *l, ExecutionEngine *engine, const Value &object)
Definition qv4lookup_p.h:40
struct QV4::Lookup::@584::@598 qobjectLookup
struct QV4::Lookup::@584::@600 qobjectFallbackLookup
static bool setterFallbackAsVariant(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value)
bool(* setter)(Lookup *l, ExecutionEngine *engine, Value &object, const Value &v)
Definition qv4lookup_p.h:43
struct QV4::Lookup::@584::@601 qgadgetLookup
static ReturnedValue getterFallback(Lookup *l, ExecutionEngine *engine, const Value &object)
static ReturnedValue getterFallbackAsVariant(Lookup *l, ExecutionEngine *engine, const Value &object)
void releasePropertyCache()
struct QV4::Lookup::@584::@604 qmlContextIdObjectLookup
static bool setterFallback(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value)
struct QV4::Lookup::@584::@603 qmlContextSingletonLookup
static ReturnedValue lookupAttached(Lookup *l, ExecutionEngine *engine, const Value &object)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static ReturnedValue lookupSingleton(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupIdObjectInParentContext(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupIdObject(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupScopeFallbackProperty(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue lookupType(Lookup *l, ExecutionEngine *engine, Value *base)
static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlType &, Heap::QQmlTypeWrapper::TypeNameMode=Heap::QQmlTypeWrapper::IncludeEnums)
static ReturnedValue lookupEnumValue(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue lookupSingletonProperty(Lookup *l, ExecutionEngine *engine, const Value &base)
static bool lookupSetter(QV4::Lookup *l, QV4::ExecutionEngine *engine, QV4::Value &object, const QV4::Value &value)
static ReturnedValue lookupGetter(Lookup *lookup, ExecutionEngine *engine, const Value &object)
bool hasException() const
ExecutionEngine * engine
void wrapper()