Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmlvmemetaobject.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 BasysKom GmbH.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
6
7#include <private/qqmlrefcount_p.h>
9#include <qqmlinfo.h>
10
11#include <private/qqmlglobal_p.h>
12
13#include <private/qv4object_p.h>
14#include <private/qv4variantobject_p.h>
15#include <private/qv4functionobject_p.h>
16#include <private/qv4scopedvalue_p.h>
17#include <private/qv4jscall_p.h>
18#include <private/qv4qobjectwrapper_p.h>
19#include <private/qv4sequenceobject_p.h>
20#include <private/qqmlpropertycachecreator_p.h>
21#include <private/qqmlpropertycachemethodarguments_p.h>
22#include <private/qqmlvaluetypewrapper_p.h>
23
24#include <QtCore/qsequentialiterable.h>
25
26#include <climits> // for CHAR_BIT
27
29
31{
32 // see QQmlVMEMetaObject::metaCall for how this was constructed
33 auto encodedIndex = quintptr(prop->data);
34 constexpr quintptr usableBits = sizeof(quintptr) * CHAR_BIT;
35 quintptr inheritanceDepth = encodedIndex >> (usableBits / 2);
36 m_id = encodedIndex & ((quintptr(1) << (usableBits / 2)) - 1);
37
38 // walk up to the correct meta object if necessary
39 auto mo = static_cast<QQmlVMEMetaObject *>(QObjectPrivate::get(prop->object)->metaObject);
40 while (inheritanceDepth--)
41 mo = mo->parentVMEMetaObject();
42 m_metaObject = mo;
43 Q_ASSERT(m_metaObject);
44 Q_ASSERT(::strstr(m_metaObject->toDynamicMetaObject(prop->object)
45 ->property(m_metaObject->propOffset() + m_id)
46 .typeName(),
47 "QQmlListProperty"));
48 Q_ASSERT(m_metaObject->object == prop->object);
49
50 // readPropertyAsList() with checks transformed into Q_ASSERT
51 // and without allocation.
52 if (m_metaObject->propertyAndMethodStorage.isUndefined()
53 && m_metaObject->propertyAndMethodStorage.valueRef()) {
54 return;
55 }
56
57 if (auto *md = static_cast<QV4::MemberData *>(
58 m_metaObject->propertyAndMethodStorage.asManaged())) {
59 const auto *v = (md->data() + m_id)->as<QV4::VariantObject>();
60 Q_ASSERT(v);
61 Q_ASSERT(v->d());
62 QVariant &data = v->d()->data();
64 m_list = static_cast<QVector<QQmlGuard<QObject>> *>(data.data());
65 Q_ASSERT(m_list);
66 }
67}
68
70
72{
73 m_metaObject->activate(m_metaObject->object, int(m_id + m_metaObject->methodOffset()), nullptr);
74}
75
77{
78 const QQmlVMEResolvedList resolved(prop);
79 resolved.list()->append(o);
80 resolved.activateSignal();
81}
82
84{
85 QQmlVMEResolvedList(prop).list()->append(o);
86}
87
89{
90 return QQmlVMEResolvedList(prop).list()->size();
91}
92
94{
95 return QQmlVMEResolvedList(prop).list()->at(index);
96}
97
99{
100 const QQmlVMEResolvedList resolved(prop);
101 resolved.list()->clear();
102 resolved.activateSignal();
103}
104
106{
107 QQmlVMEResolvedList(prop).list()->clear();
108}
109
111{
112 const QQmlVMEResolvedList resolved(prop);
113 resolved.list()->replace(index, o);
114 resolved.activateSignal();
115}
116
118{
119 const QQmlVMEResolvedList resolved(prop);
120 resolved.list()->removeLast();
121 resolved.activateSignal();
122}
123
125 : QQmlGuard<QObject>(QQmlVMEVariantQObjectPtr::objectDestroyedImpl, nullptr), m_target(nullptr), m_index(-1)
126{
127}
128
129void QQmlVMEVariantQObjectPtr::objectDestroyedImpl(QQmlGuardImpl *guard)
130{
131 auto This = static_cast<QQmlVMEVariantQObjectPtr *>(guard);
132 if (!This->m_target || QQmlData::wasDeleted(This->m_target->object))
133 return;
134
135 if (This->m_index >= 0) {
136 QV4::ExecutionEngine *v4 = This->m_target->propertyAndMethodStorage.engine();
137 if (v4) {
138 QV4::Scope scope(v4);
139 QV4::Scoped<QV4::MemberData> sp(scope, This->m_target->propertyAndMethodStorage.value());
140 if (sp) {
141 QV4::PropertyIndex index{ sp->d(), sp->d()->values.values + This->m_index };
142 index.set(v4, QV4::Value::nullValue());
143 }
144 }
145
146 This->m_target->activate(This->m_target->object, This->m_target->methodOffset() + This->m_index, nullptr);
147 }
148}
149
151{
153 m_index = index;
154 setObject(obj);
155}
156
158{
159public:
161 void tryConnect();
162
163 enum Tag {
166 };
167
169};
170
173{
174}
175
177{
179 vmee->tryConnect();
180}
181
183{
185 int aliasId = this - metaObject->aliasEndpoints;
186
188 // This is actually notify
189 int sigIdx = metaObject->methodOffset() + aliasId + metaObject->compiledObject->nProperties;
190 metaObject->activate(metaObject->object, sigIdx, nullptr);
191 } else {
192 const QV4::CompiledData::Alias *aliasData = &metaObject->compiledObject->aliasTable()[aliasId];
193 if (!aliasData->isObjectAlias()) {
195 QObject *target = ctxt->idValue(aliasData->targetObjectId());
196 if (!target)
197 return;
198
200 int coreIndex = encodedIndex.coreIndex();
201 int valueTypeIndex = encodedIndex.valueTypeIndex();
202 const QQmlPropertyData *pd = QQmlData::ensurePropertyCache(target)->property(coreIndex);
203 if (pd && valueTypeIndex != -1 && !QQmlMetaType::valueType(pd->propType())) {
204 // deep alias
205 const QQmlPropertyCache::ConstPtr newPropertyCache
207 void *argv[1] = { &target };
209 Q_ASSERT(newPropertyCache);
210 pd = newPropertyCache->property(valueTypeIndex);
211 }
212 if (!pd)
213 return;
214
215 if (pd->notifyIndex() != -1 && ctxt->engine())
216 connect(target, pd->notifyIndex(), ctxt->engine());
217 }
218
220 }
221}
222
223
225 : object(obj),
226 cache(cache)
227{
229
230 if (op->metaObject) {
231 parent = op->metaObject;
232 // Use the extra flag in QBiPointer to know if we can safely cast parent.asT1() to QQmlVMEMetaObject*
233 parent.setFlagValue(QQmlData::get(obj)->hasVMEMetaObject);
234 } else {
235 parent = obj->metaObject();
236 }
237
238 op->metaObject = this;
240}
241
243{
244
245}
246
248{
249 for (QQmlPropertyValueInterceptor *vi = interceptors; vi; vi = vi->m_next) {
250 if (Q_UNLIKELY(vi->m_propertyIndex.coreIndex() == index.coreIndex())) {
251 qWarning() << "Attempting to set another interceptor on "
252 << object->metaObject()->className() << "property"
253 << object->metaObject()->property(index.coreIndex()).name()
254 << "- unsupported";
255 }
256 }
257
258 interceptor->m_propertyIndex = index;
259 interceptor->m_next = interceptors;
260 interceptors = interceptor;
261}
262
264{
265 Q_ASSERT(o == object);
266 Q_UNUSED(o);
267
268 if (intercept(c, id, a))
269 return -1;
270 return object->qt_metacall(c, id, a);
271}
272
273bool QQmlInterceptorMetaObject::doIntercept(QMetaObject::Call c, int id, void **a)
274{
275 for (QQmlPropertyValueInterceptor *vi = interceptors; vi; vi = vi->m_next) {
276 if (vi->m_propertyIndex.coreIndex() != id)
277 continue;
278
279 const int valueIndex = vi->m_propertyIndex.valueTypeIndex();
280 const QQmlData *data = QQmlData::get(object);
281 const QMetaType metaType = data->propertyCache->property(id)->propType();
282
283 if (metaType.isValid()) {
284 if (valueIndex != -1 && c == QMetaObject::WriteProperty) {
285
286 // If we didn't intend to change the property this interceptor cares about,
287 // then don't bother intercepting it. There may be an animation running on
288 // the property. We shouldn't disturb it.
289 const int changedProperty
290 = (*static_cast<int *>(a[3]) & QQmlPropertyData::HasInternalIndex)
291 ? *static_cast<int *>(a[4])
292 : QV4::ReferenceObject::AllProperties;
293 if (changedProperty == QV4::ReferenceObject::AllProperties
294 || changedProperty == valueIndex) {
295 // TODO: handle intercepting bindable properties for value types?
297 data->context->engine(), metaType);
298 Q_ASSERT(valueType);
299
300 //
301 // Consider the following case:
302 // color c = { 0.1, 0.2, 0.3 }
303 // interceptor exists on c.r
304 // write { 0.2, 0.4, 0.6 }
305 //
306 // The interceptor may choose not to update the r component at this
307 // point (for example, a behavior that creates an animation). But we
308 // need to ensure that the g and b components are updated correctly.
309 //
310 // So we need to perform a full write where the value type is:
311 // r = old value, g = new value, b = new value
312 //
313 // And then call the interceptor which may or may not write the
314 // new value to the r component.
315 //
316 // This will ensure that the other components don't contain stale data
317 // and any relevant signals are emitted.
318 //
319 // To achieve this:
320 // (1) Store the new value type as a whole (needed due to
321 // aliasing between a[0] and static storage in value type).
322 // (2) Read the entire existing value type from object -> valueType temp.
323 // (3) Read the previous value of the component being changed
324 // from the valueType temp.
325 // (4) Write the entire new value type into the temp.
326 // (5) Overwrite the component being changed with the old value.
327 // (6) Perform a full write to the value type (which may emit signals etc).
328 // (7) Issue the interceptor call with the new component value.
329 //
330
331 QMetaProperty valueProp = valueType->property(valueIndex);
332 QVariant newValue(metaType, a[0]);
333
334 valueType->read(object, id);
335 QVariant prevComponentValue = valueType->readOnGadget(valueProp);
336
337 valueType->setValue(newValue);
338 QVariant newComponentValue = valueType->readOnGadget(valueProp);
339
340 // If the intercepted value seemingly has not changed, we still need to
341 // invoke the interceptor. There may be a pending animation that will
342 // change the value soon. Such an animation needs to be canceled if the
343 // current value is explicitly set.
344 // So, we cannot return here if prevComponentValue == newComponentValue.
345 valueType->writeOnGadget(valueProp, std::move(prevComponentValue));
347
348 vi->write(newComponentValue);
349 return true;
350 }
351 } else if (c == QMetaObject::WriteProperty) {
352 vi->write(QVariant(metaType, a[0]));
353 return true;
354 } else {
355 object->qt_metacall(c, id, a);
356 QUntypedBindable target = *reinterpret_cast<QUntypedBindable *>(a[0]);
357 return vi->bindable(reinterpret_cast<QUntypedBindable *>(a[0]), target);
358 }
359 }
360 }
361
362 return false;
363}
364
366{
367 for (const QMetaObject *mo = top; mo; mo = mo->superClass()) {
368 if (o->qt_metacast(mo->className()) != nullptr)
369 return const_cast<QMetaObject *>(mo);
370 }
371 return nullptr;
372}
373
375{
376 if (!metaObject)
377 metaObject = cache->createMetaObject();
378
381
382 // ### Qt7: The const_cast is only due to toDynamicMetaObject having the wrong return type.
383 // It should be const QMetaObject *. Fix this.
384 return const_cast<QMetaObject *>(metaObject.data());
385}
386
388 QObject *obj,
389 const QQmlPropertyCache::ConstPtr &cache, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &qmlCompilationUnit, int qmlObjectId)
391 engine(engine),
392 ctxt(QQmlData::get(obj, true)->outerContext),
393 aliasEndpoints(nullptr), compilationUnit(qmlCompilationUnit), compiledObject(nullptr)
394{
397
398 if (compilationUnit && qmlObjectId >= 0) {
400
403 if (size) {
404 QV4::Heap::MemberData *data = QV4::MemberData::allocate(engine, size);
406 std::fill(data->values.values, data->values.values + data->values.size, QV4::Encode::undefined());
407 }
408
409 // Need JS wrapper to ensure properties/methods are marked.
411 }
412 }
413}
414
416{
417 if (parent.isT1()) parent.asT1()->objectDestroyed(object);
418 delete [] aliasEndpoints;
419
421}
422
424{
427 // in some situations, the QObject wrapper (and associated data,
428 // such as the varProperties array) will have been cleaned up, but the
429 // QObject ptr will not yet have been deleted (eg, waiting on deleteLater).
430 // In this situation, return 0.
431 return nullptr;
432 }
433
434 return static_cast<QV4::MemberData*>(propertyAndMethodStorage.asManaged());
435}
436
438{
440 if (md)
442}
443
445{
447 if (md)
449}
450
452{
454 if (md)
456}
457
459{
461 if (md) {
462 QV4::Scope scope(engine);
463 QV4::Scoped<QV4::MemberData>(scope, md)->set(engine, id, engine->newString(v));
464 }
465}
466
468{
470 if (md) {
471 QV4::Scope scope(engine);
474 }
475
477 if (v && !guard) {
478 guard = new QQmlVMEVariantQObjectPtr();
479 varObjectGuards.append(guard);
480 }
481 if (guard)
482 guard->setGuardedValue(v, this, id);
483}
484
486{
488 if (!md)
489 return 0;
490
491 QV4::Scope scope(engine);
492 QV4::ScopedValue sv(scope, *(md->data() + id));
493 if (!sv->isInt32())
494 return 0;
495 return sv->integerValue();
496}
497
499{
501 if (!md)
502 return false;
503
504 QV4::Scope scope(engine);
505 QV4::ScopedValue sv(scope, *(md->data() + id));
506 if (!sv->isBoolean())
507 return false;
508 return sv->booleanValue();
509}
510
512{
514 if (!md)
515 return 0.0;
516
517 QV4::Scope scope(engine);
518 QV4::ScopedValue sv(scope, *(md->data() + id));
519 if (!sv->isDouble())
520 return 0.0;
521 return sv->doubleValue();
522}
523
525{
527 if (!md)
528 return QString();
529
530 QV4::Scope scope(engine);
531 QV4::ScopedValue sv(scope, *(md->data() + id));
532 if (QV4::String *s = sv->stringValue())
533 return s->toQString();
534 return QString();
535}
536
538{
540 if (!md)
541 return QUrl();
542
543 QV4::Scope scope(engine);
544 QV4::ScopedValue sv(scope, *(md->data() + id));
546 if (!v || v->d()->data().userType() != QMetaType::QUrl)
547 return QUrl();
548 return v->d()->data().value<QUrl>();
549}
550
552{
554 if (!md)
555 return QDate();
556
557 QV4::Scope scope(engine);
558 QV4::ScopedValue sv(scope, *(md->data() + id));
560 if (!v || v->d()->data().userType() != QMetaType::QDate)
561 return QDate();
562 return v->d()->data().value<QDate>();
563}
564
566{
568 if (!md)
569 return QTime();
570
571 QV4::Scope scope(engine);
572 QV4::ScopedValue sv(scope, *(md->data() + id));
574 if (!v || v->d()->data().userType() != QMetaType::QTime)
575 return QTime();
576 return v->d()->data().value<QTime>();
577}
578
580{
582 if (!md)
583 return QDateTime();
584
585 QV4::Scope scope(engine);
586 QV4::ScopedValue sv(scope, *(md->data() + id));
588 if (!v || v->d()->data().userType() != QMetaType::QDateTime)
589 return QDateTime();
590 return v->d()->data().value<QDateTime>();
591}
592
593#if QT_CONFIG(regularexpression)
594QRegularExpression QQmlVMEMetaObject::readPropertyAsRegularExpression(int id) const
595{
597 if (!md)
598 return QRegularExpression();
599
600 QV4::Scope scope(engine);
601 QV4::ScopedValue sv(scope, *(md->data() + id));
603 if (!v || v->d()->data().userType() != QMetaType::QRegularExpression)
604 return QRegularExpression();
605 return v->d()->data().value<QRegularExpression>();
606}
607#endif
608
610{
612 if (!md)
613 return QSizeF();
614
615 QV4::Scope scope(engine);
616 QV4::ScopedValue sv(scope, *(md->data() + id));
618 if (!v || v->d()->data().userType() != QMetaType::QSizeF)
619 return QSizeF();
620 return v->d()->data().value<QSizeF>();
621}
622
624{
626 if (!md)
627 return QPointF();
628
629 QV4::Scope scope(engine);
630 QV4::ScopedValue sv(scope, *(md->data() + id));
632 if (!v || v->d()->data().userType() != QMetaType::QPointF)
633 return QPointF();
634 return v->d()->data().value<QPointF>();
635}
636
638{
640 if (!md)
641 return nullptr;
642
643 QV4::Scope scope(engine);
644 QV4::ScopedValue sv(scope, *(md->data() + id));
646 if (!wrapper)
647 return nullptr;
648 return wrapper->object();
649}
650
652{
654 if (!md)
655 return nullptr;
656
657 QV4::Scope scope(engine);
658 QV4::Scoped<QV4::VariantObject> v(scope, *(md->data() + id));
659 if (!v || v->d()->data().metaType() != QMetaType::fromType<QVector<QQmlGuard<QObject>>>()) {
660 const QVector<QQmlGuard<QObject>> guards;
662 md->set(engine, id, v);
663 }
664 return static_cast<QVector<QQmlGuard<QObject>> *>(v->d()->data().data());
665}
666
668{
670 if (!md)
671 return QRectF();
672
673 QV4::Scope scope(engine);
674 QV4::ScopedValue sv(scope, *(md->data() + id));
676 if (!v || v->d()->data().userType() != QMetaType::QRectF)
677 return QRectF();
678 return v->d()->data().value<QRectF>();
679}
680
682{
683 Q_ASSERT(o == object);
684 Q_UNUSED(o);
685
686 int id = _id;
687
688 if (intercept(c, _id, a))
689 return -1;
690
691 const int propertyCount = compiledObject ? int(compiledObject->nProperties) : 0;
692 const int aliasCount = compiledObject ? int(compiledObject->nAliases) : 0;
693 const int signalCount = compiledObject ? int(compiledObject->nSignals) : 0;
694 const int methodCount = compiledObject ? int(compiledObject->nFunctions) : 0;
695
697 if (id >= propOffset()) {
698 id -= propOffset();
699
700 if (id < propertyCount) {
701 // if we reach this point, propertyCount must have been > 0, and thus compiledObject != nullptr
704 const QV4::CompiledData::CommonType t = property.commonType();
705
706 // the context can be null if accessing var properties from cpp after re-parenting an item.
707 QQmlEnginePrivate *ep = (ctxt.isNull() || ctxt->engine() == nullptr)
708 ? nullptr
710
712 if (property.isList()) {
713 // _id because this is an absolute property ID.
714 const QQmlPropertyData *propertyData = cache->property(_id);
715 const QMetaType propType = propertyData->propType();
716
717 if (propType.flags().testFlag(QMetaType::IsQmlList)) {
718 // when reading from the list, we need to find the correct MetaObject,
719 // namely this. However, obejct->metaObject might point to any
720 // MetaObject down the inheritance hierarchy, so we need to store how
721 // far we have to go down
722 // To do this, we encode the hierarchy depth together with the id of the
723 // property in a single quintptr, with the first half storing the depth
724 // and the second half storing the property id
725 auto mo = static_cast<QQmlVMEMetaObject *>(
727 quintptr inheritanceDepth = 0u;
728 while (mo && mo != this) {
729 mo = mo->parentVMEMetaObject();
730 ++inheritanceDepth;
731 }
732 constexpr quintptr idBits = sizeof(quintptr) * CHAR_BIT / 2u;
733 if (Q_UNLIKELY(inheritanceDepth >= (quintptr(1) << idBits))) {
734 qmlWarning(object) << "Too many objects in inheritance hierarchy "
735 "for list property";
736 return -1;
737 }
738 if (Q_UNLIKELY(quintptr(id) >= (quintptr(1) << idBits))) {
739 qmlWarning(object) << "Too many properties in object "
740 "for list property";
741 return -1;
742 }
743 quintptr encodedIndex = (inheritanceDepth << idBits) + id;
744
745 readPropertyAsList(id); // Initializes if necessary
746 *static_cast<QQmlListProperty<QObject> *>(a[0])
748 object, reinterpret_cast<void *>(quintptr(encodedIndex)),
752 // Value type list
753 QV4::Scope scope(engine);
754 QV4::Scoped<QV4::Sequence> sequence(scope, *(md->data() + id));
755 const void *data = sequence
757 : nullptr;
758 propType.destruct(a[0]);
759 propType.construct(a[0], data);
760 } else {
761 qmlWarning(object) << "Cannot find member data";
762 }
763 } else {
764 switch (t) {
766 break;
768 *reinterpret_cast<int *>(a[0]) = readPropertyAsInt(id);
769 break;
771 *reinterpret_cast<bool *>(a[0]) = readPropertyAsBool(id);
772 break;
774 *reinterpret_cast<double *>(a[0]) = readPropertyAsDouble(id);
775 break;
777 *reinterpret_cast<QString *>(a[0]) = readPropertyAsString(id);
778 break;
780 *reinterpret_cast<QUrl *>(a[0]) = readPropertyAsUrl(id);
781 break;
783 *reinterpret_cast<QDate *>(a[0]) = readPropertyAsDate(id);
784 break;
786 *reinterpret_cast<QDateTime *>(a[0]) = readPropertyAsDateTime(id);
787 break;
789#if QT_CONFIG(regularexpression)
790 *reinterpret_cast<QRegularExpression *>(a[0])
791 = readPropertyAsRegularExpression(id);
792#endif
793 break;
795 *reinterpret_cast<QRectF *>(a[0]) = readPropertyAsRectF(id);
796 break;
798 *reinterpret_cast<QSizeF *>(a[0]) = readPropertyAsSizeF(id);
799 break;
801 *reinterpret_cast<QPointF *>(a[0]) = readPropertyAsPointF(id);
802 break;
804 *reinterpret_cast<QTime *>(a[0]) = readPropertyAsTime(id);
805 break;
807 if (ep) {
808 *reinterpret_cast<QVariant *>(a[0]) = readPropertyAsVariant(id);
809 } else {
810 // if the context was disposed,
811 // we just return an invalid variant from read.
812 *reinterpret_cast<QVariant *>(a[0]) = QVariant();
813 }
814 break;
817 QV4::Scope scope(engine);
818 QV4::ScopedValue sv(scope, *(md->data() + id));
819
820 // _id because this is an absolute property ID.
821 const QQmlPropertyData *propertyData = cache->property(_id);
822
823 if (propertyData->isQObject()) {
824 if (const auto *wrap = sv->as<QV4::QObjectWrapper>())
825 *reinterpret_cast<QObject **>(a[0]) = wrap->object();
826 else
827 *reinterpret_cast<QObject **>(a[0]) = nullptr;
828 } else {
829 const QMetaType propType = propertyData->propType();
830 const void *data = nullptr;
831 if (const auto *v = sv->as<QV4::VariantObject>()) {
832 const QVariant &variant = v->d()->data();
833 if (variant.metaType() == propType)
835 }
836 propType.destruct(a[0]);
837 propType.construct(a[0], data);
838 }
839 } else {
840 qmlWarning(object) << "Cannot find member data";
841 }
842 }
843 }
844 } else if (c == QMetaObject::WriteProperty) {
845 bool needActivate = false;
846
847 if (property.isList()) {
848 // _id because this is an absolute property ID.
849 const QQmlPropertyData *propertyData = cache->property(_id);
850 const QMetaType propType = propertyData->propType();
851
852 if (propType.flags().testFlag(QMetaType::IsQmlList)) {
853 // Writing such a property is not supported. Content is added through
854 // the list property methods.
856 // Value type list
857 QV4::Scope scope(engine);
858 QV4::Scoped<QV4::Sequence> sequence(scope, *(md->data() + id));
859 void *data = sequence
861 : nullptr;
862 if (data) {
863 if (!propType.equals(data, a[0])) {
864 propType.destruct(data);
865 propType.construct(data, a[0]);
866 needActivate = true;
867 }
868 } else {
869 if (const QQmlType type = QQmlMetaType::qmlListType(propType);
872 engine, propType, type.listMetaSequence(), a[0]);
873 } else if (QSequentialIterable iterable;
875 propType, a[0],
876 QMetaType::fromType<QSequentialIterable>(),
877 &iterable)) {
879 engine, propType, iterable.metaContainer(), a[0]);
880 } else {
881 sequence = QV4::Encode::undefined();
882 }
883 md->set(engine, id, sequence);
884 if (sequence->isUndefined()) {
885 qmlWarning(object)
886 << "Could not create a QML sequence object for "
887 << propType.name();
888 }
889 needActivate = true;
890 }
891 } else {
892 qmlWarning(object) << "Cannot find member data";
893 }
894 } else {
895 switch (t) {
897 break;
899 needActivate = *reinterpret_cast<int *>(a[0]) != readPropertyAsInt(id);
900 writeProperty(id, *reinterpret_cast<int *>(a[0]));
901 break;
903 needActivate = *reinterpret_cast<bool *>(a[0]) != readPropertyAsBool(id);
904 writeProperty(id, *reinterpret_cast<bool *>(a[0]));
905 break;
907 needActivate = *reinterpret_cast<double *>(a[0]) != readPropertyAsDouble(id);
908 writeProperty(id, *reinterpret_cast<double *>(a[0]));
909 break;
911 needActivate = *reinterpret_cast<QString *>(a[0]) != readPropertyAsString(id);
912 writeProperty(id, *reinterpret_cast<QString *>(a[0]));
913 break;
915 needActivate = *reinterpret_cast<QUrl *>(a[0]) != readPropertyAsUrl(id);
916 writeProperty(id, *reinterpret_cast<QUrl *>(a[0]));
917 break;
919 needActivate = *reinterpret_cast<QDate *>(a[0]) != readPropertyAsDate(id);
920 writeProperty(id, *reinterpret_cast<QDate *>(a[0]));
921 break;
923 needActivate = *reinterpret_cast<QDateTime *>(a[0]) != readPropertyAsDateTime(id);
924 writeProperty(id, *reinterpret_cast<QDateTime *>(a[0]));
925 break;
927#if QT_CONFIG(regularexpression)
928 needActivate = *reinterpret_cast<QRegularExpression *>(a[0])
929 != readPropertyAsRegularExpression(id);
930 writeProperty(id, *reinterpret_cast<QRegularExpression *>(a[0]));
931#endif
932 break;
934 needActivate = *reinterpret_cast<QRectF *>(a[0]) != readPropertyAsRectF(id);
935 writeProperty(id, *reinterpret_cast<QRectF *>(a[0]));
936 break;
938 needActivate = *reinterpret_cast<QSizeF *>(a[0]) != readPropertyAsSizeF(id);
939 writeProperty(id, *reinterpret_cast<QSizeF *>(a[0]));
940 break;
942 needActivate = *reinterpret_cast<QPointF *>(a[0]) != readPropertyAsPointF(id);
943 writeProperty(id, *reinterpret_cast<QPointF *>(a[0]));
944 break;
946 needActivate = *reinterpret_cast<QTime *>(a[0]) != readPropertyAsTime(id);
947 writeProperty(id, *reinterpret_cast<QTime *>(a[0]));
948 break;
950 if (ep)
951 writeProperty(id, *reinterpret_cast<QVariant *>(a[0]));
952 break;
955 QV4::Scope scope(engine);
956 QV4::ScopedValue sv(scope, *(md->data() + id));
957
958 // _id because this is an absolute property ID.
959 const QQmlPropertyData *propertyData = cache->property(_id);
960
961 if (propertyData->isQObject()) {
962 QObject *arg = *reinterpret_cast<QObject **>(a[0]);
963 if (const auto *wrap = sv->as<QV4::QObjectWrapper>())
964 needActivate = wrap->object() != arg;
965 else if (arg != nullptr || !sv->isNull())
966 needActivate = true;
967 if (needActivate)
968 writeProperty(id, arg);
969 } else {
970 const QMetaType propType = propertyData->propType();
971 if (const auto *v = sv->as<QV4::VariantObject>()) {
972 QVariant &variant = v->d()->data();
973 if (variant.metaType() != propType) {
974 needActivate = true;
975 variant = QVariant(propType, a[0]);
976 } else if (!propType.equals(variant.constData(), a[0])) {
977 needActivate = true;
978 propType.destruct(variant.data());
979 propType.construct(variant.data(), a[0]);
980 }
981 } else {
982 needActivate = true;
984 propType, a[0]));
985 }
986 }
987 } else {
988 qmlWarning(object) << "Cannot find member data";
989 }
990 }
991 }
992
993 if (needActivate)
994 activate(object, methodOffset() + id, nullptr);
995 }
996
997 return -1;
998 }
999
1000 id -= propertyCount;
1001
1002 if (id < aliasCount) {
1003 const QV4::CompiledData::Alias *aliasData = &compiledObject->aliasTable()[id];
1004
1007 *reinterpret_cast<void **>(a[0]) = nullptr;
1008 }
1009
1010 if (ctxt.isNull())
1011 return -1;
1012
1013 while (aliasData->isAliasToLocalAlias())
1014 aliasData = &compiledObject->aliasTable()[aliasData->localAliasIndex];
1015
1016 QObject *target = ctxt->idValue(aliasData->targetObjectId());
1017 if (!target)
1018 return -1;
1019
1020 connectAlias(id);
1021
1022 if (aliasData->isObjectAlias()) {
1023 *reinterpret_cast<QObject **>(a[0]) = target;
1024 return -1;
1025 }
1026
1027 QQmlData *targetDData = QQmlData::get(target, /*create*/false);
1028 if (!targetDData)
1029 return -1;
1030
1032 int coreIndex = encodedIndex.coreIndex();
1033 const int valueTypePropertyIndex = encodedIndex.valueTypeIndex();
1034
1035 // Remove binding (if any) on write
1037 int flags = *reinterpret_cast<int*>(a[3]);
1039 QQmlData *targetData = QQmlData::get(target);
1040 if (targetData && targetData->hasBindingBit(coreIndex))
1042 }
1043 }
1044
1045 if (valueTypePropertyIndex != -1) {
1046 if (!targetDData->propertyCache)
1047 return -1;
1048 const QQmlPropertyData *pd = targetDData->propertyCache->property(coreIndex);
1049 // Value type property or deep alias
1051 ctxt->engine(), pd->propType());
1052 if (valueType) {
1053 valueType->read(target, coreIndex);
1054 int rv = QMetaObject::metacall(valueType, c, valueTypePropertyIndex, a);
1055
1057 valueType->write(target, coreIndex, QQmlPropertyData::HasInternalIndex,
1058 valueTypePropertyIndex);
1059
1060 return rv;
1061 } else {
1062 // deep alias
1063 void *argv[1] = { &target };
1065 return QMetaObject::metacall(target, c, valueTypePropertyIndex, a);
1066 }
1067
1068 } else {
1069 return QMetaObject::metacall(target, c, coreIndex, a);
1070 }
1071
1072 }
1073 return -1;
1074
1075 }
1076
1077 } else if(c == QMetaObject::InvokeMetaMethod) {
1078
1079 if (id >= methodOffset()) {
1080
1081 id -= methodOffset();
1082 int plainSignals = signalCount + propertyCount + aliasCount;
1083 if (id < plainSignals) {
1084 activate(object, _id, a);
1085 return -1;
1086 }
1087
1088 id -= plainSignals;
1089
1090 if (id < methodCount) {
1092 if (!engine)
1093 return -1; // We can't run the method
1094
1096 QV4::ExecutionEngine *v4 = engine->handle();
1097 ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation.
1098 QV4::Scope scope(v4);
1099
1100
1102 if (!function) {
1103 // The function was not compiled. There are some exceptional cases which the
1104 // expression rewriter does not rewrite properly (e.g., \r-terminated lines
1105 // are not rewritten correctly but this bug is deemed out-of-scope to fix for
1106 // performance reasons; see QTBUG-24064) and thus compilation will have failed.
1107 QQmlError e;
1108 e.setDescription(
1110 "Exception occurred during compilation of function: ")
1112 ep->warning(e);
1113 return -1; // The dynamic method with that id is not available.
1114 }
1115
1116 auto methodData = cache->method(_id);
1117 auto arguments = methodData->hasArguments() ? methodData->arguments() : nullptr;
1118
1119 if (arguments && arguments->names) {
1120 const quint32 parameterCount = arguments->names->size();
1121 Q_ASSERT(parameterCount == function->formalParameterCount());
1122 if (void *result = a[0])
1123 arguments->types[0].destruct(result);
1124 function->call(nullptr, a, arguments->types, parameterCount);
1125 } else {
1126 Q_ASSERT(function->formalParameterCount() == 0);
1127 const QMetaType returnType = methodData->propType();
1128 if (void *result = a[0])
1129 returnType.destruct(result);
1130 function->call(nullptr, a, &returnType, 0);
1131 }
1132
1133 if (scope.hasException()) {
1135 if (error.isValid())
1136 ep->warning(error);
1137 }
1138
1139 ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
1140 return -1;
1141 }
1142 return -1;
1143 }
1144 }
1145
1146 if (parent.isT1())
1147 return parent.asT1()->metaCall(object, c, _id, a);
1148 else
1149 return object->qt_metacall(c, _id, a);
1150}
1151
1153{
1154 if (ctxt.isNull() || !ctxt->isValid() || !compiledObject) {
1155 qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context");
1156 return QV4::Encode::undefined();
1157 }
1158
1160 if (!md)
1161 return QV4::Encode::undefined();
1162
1163 return (md->data() + index + compiledObject->nProperties)->asReturnedValue();
1164}
1165
1167{
1169
1171 if (md)
1172 return (md->data() + id)->asReturnedValue();
1174}
1175
1177{
1179 if (md) {
1180 const QV4::QObjectWrapper *wrapper = (md->data() + id)->as<QV4::QObjectWrapper>();
1181 if (wrapper)
1182 return QVariant::fromValue(wrapper->object());
1183 const QV4::VariantObject *v = (md->data() + id)->as<QV4::VariantObject>();
1184 if (v)
1185 return v->d()->data();
1186 return QV4::ExecutionEngine::toVariant(*(md->data() + id), QMetaType {});
1187 }
1188 return QVariant();
1189}
1190
1192{
1194
1196 if (!md)
1197 return;
1198
1199 // Importantly, if the current value is a scarce resource, we need to ensure that it
1200 // gets automatically released by the engine if no other references to it exist.
1201 const QV4::VariantObject *oldVariant = (md->data() + id)->as<QV4::VariantObject>();
1202 if (oldVariant)
1203 oldVariant->removeVmePropertyReference();
1204
1205 QObject *valueObject = nullptr;
1207
1208 // And, if the new value is a scarce resource, we need to ensure that it does not get
1209 // automatically released by the engine until no other references to it exist.
1210 if (QV4::VariantObject *v = const_cast<QV4::VariantObject*>(value.as<QV4::VariantObject>())) {
1211 v->addVmePropertyReference();
1212 md->set(engine, id, value);
1213 } else if (QV4::QObjectWrapper *wrapper = const_cast<QV4::QObjectWrapper*>(value.as<QV4::QObjectWrapper>())) {
1214 // We need to track this QObject to signal its deletion
1215 valueObject = wrapper->object();
1216
1217 // Do we already have a QObject guard for this property?
1218 if (valueObject && !guard) {
1219 guard = new QQmlVMEVariantQObjectPtr();
1220 varObjectGuards.append(guard);
1221 }
1222 md->set(engine, id, value);
1223 } else if (const QV4::Sequence *sequence = value.as<QV4::Sequence>()) {
1224 QV4::Heap::Sequence *p = sequence->d();
1225 if (p->enforcesLocation()) {
1226 // If the sequence enforces its location, we don't want it to be updated anymore after
1227 // being written to a property.
1229 } else {
1230 // Otherwise, make sure the reference carries some value so that we can still call
1231 // toVariant() on it (see note in QV4::SequencePrototype::toVariant).
1232 if (!p->hasData())
1234 md->set(engine, id, p);
1235 }
1237 // If the value type enforces its location, we don't want it to be updated anymore after
1238 // being written to a property.
1239 QV4::Heap::QQmlValueTypeWrapper *p = wrapper->d();
1240 md->set(engine, id, p->enforcesLocation() ? QV4::ReferenceObject::detached(p) : p);
1241 } else {
1242 md->set(engine, id, value);
1243 }
1244
1245 if (guard)
1246 guard->setGuardedValue(valueObject, this, id);
1247
1248 // Emit change signal as appropriate.
1249 activate(object, methodOffset() + id, nullptr);
1250}
1251
1253{
1256 if (!md)
1257 return;
1258
1259 // Importantly, if the current value is a scarce resource, we need to ensure that it
1260 // gets automatically released by the engine if no other references to it exist.
1261 const QV4::VariantObject *oldv = (md->data() + id)->as<QV4::VariantObject>();
1262 if (oldv)
1264
1265 // And, if the new value is a scarce resource, we need to ensure that it does not get
1266 // automatically released by the engine until no other references to it exist.
1267 QV4::Scope scope(engine);
1270 if (!!v)
1271 v->addVmePropertyReference();
1272
1273 // Write the value and emit change signal as appropriate.
1275 md->set(engine, id, newv);
1276 if ((currentValue.userType() != value.userType() || currentValue != value))
1277 activate(object, methodOffset() + id, nullptr);
1278 } else {
1279 bool needActivate = false;
1280 if (value.userType() == QMetaType::QObjectStar) {
1281 QObject *o = *(QObject *const *)value.data();
1282 needActivate = readPropertyAsQObject(id) != o; // TODO: still correct?
1283 writeProperty(id, o);
1284 } else {
1286 if (md) {
1287 const QV4::VariantObject *v = (md->data() + id)->as<QV4::VariantObject>();
1288 needActivate = (!v ||
1289 v->d()->data().userType() != value.userType() ||
1290 v->d()->data() != value);
1291 if (v)
1293 md->set(engine, id, engine->newVariantObject(value.metaType(), value.constData()));
1294 v = static_cast<const QV4::VariantObject *>(md->data() + id);
1296 }
1297 }
1298
1299 if (needActivate)
1300 activate(object, methodOffset() + id, nullptr);
1301 }
1302}
1303
1305{
1306 if (index < methodOffset()) {
1309 }
1310 if (!compiledObject)
1313 Q_ASSERT(index >= (methodOffset() + plainSignals) && index < (methodOffset() + plainSignals + int(compiledObject->nFunctions)));
1314 return method(index - methodOffset() - plainSignals);
1315}
1316
1317// Used by debugger
1319{
1320 if (index < methodOffset()) {
1323 }
1324 if (!compiledObject)
1325 return;
1327 Q_ASSERT(index >= (methodOffset() + plainSignals) && index < (methodOffset() + plainSignals + int(compiledObject->nFunctions)));
1328
1329 int methodIndex = index - methodOffset() - plainSignals;
1331 if (!md)
1332 return;
1333 md->set(engine, methodIndex + compiledObject->nProperties, function);
1334}
1335
1337{
1338 if (index < propOffset()) {
1341 }
1342 return readVarProperty(index - propOffset());
1343}
1344
1346{
1347 if (index < propOffset()) {
1350 return;
1351 }
1352 return writeVarProperty(index - propOffset(), v);
1353}
1354
1356{
1357 Q_ASSERT(cache);
1359}
1360
1362{
1363 if (engine != markStack->engine())
1364 return;
1365
1367
1369 parent->mark(markStack);
1370}
1371
1372bool QQmlVMEMetaObject::aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const
1373{
1375
1376 *target = nullptr;
1377 *coreIndex = -1;
1378 *valueTypeIndex = -1;
1379
1380 if (ctxt.isNull())
1381 return false;
1382
1383 const int aliasId = index - propOffset() - compiledObject->nProperties;
1384 const QV4::CompiledData::Alias *aliasData = &compiledObject->aliasTable()[aliasId];
1385 while (aliasData->isAliasToLocalAlias())
1386 aliasData = &compiledObject->aliasTable()[aliasData->localAliasIndex];
1387 *target = ctxt->idValue(aliasData->targetObjectId());
1388 if (!*target)
1389 return false;
1390
1391 if (!aliasData->isObjectAlias()) {
1393 *coreIndex = encodedIndex.coreIndex();
1394 *valueTypeIndex = encodedIndex.valueTypeIndex();
1395 }
1396 return true;
1397}
1398
1400{
1402 if (!aliasEndpoints)
1404
1405 const QV4::CompiledData::Alias *aliasData = &compiledObject->aliasTable()[aliasId];
1406
1407 QQmlVMEMetaObjectEndpoint *endpoint = aliasEndpoints + aliasId;
1408 if (endpoint->metaObject.data()) {
1409 // already connected
1410 Q_ASSERT(endpoint->metaObject.data() == this);
1411 return;
1412 }
1413
1414 endpoint->metaObject = this;
1415 endpoint->connect(ctxt->idValueBindings(aliasData->targetObjectId()));
1416 endpoint->tryConnect();
1417}
1418
1419void QQmlVMEMetaObject::connectAliasSignal(int index, bool indexInSignalRange)
1420{
1422 int aliasId = (index - (indexInSignalRange ? signalOffset() : methodOffset())) - compiledObject->nProperties;
1423 if (aliasId < 0 || aliasId >= int(compiledObject->nAliases))
1424 return;
1425
1426 connectAlias(aliasId);
1427}
1428
1433{
1435}
1436
1438{
1440 while (vme && vme->propOffset() > coreIndex)
1441 vme = vme->parentVMEMetaObject();
1442
1443 Q_ASSERT(vme);
1444 return vme;
1445}
1446
1448{
1450 while (vme && vme->methodOffset() > coreIndex)
1451 vme = vme->parentVMEMetaObject();
1452
1453 Q_ASSERT(vme);
1454 return vme;
1455}
1456
1462{
1464 while (vme && vme->signalOffset() > coreIndex)
1465 vme = vme->parentVMEMetaObject();
1466
1467 Q_ASSERT(vme);
1468 return vme;
1469}
1470
1472{
1474 for ( ; it != end; ++it) {
1475 if ((*it)->m_index == index) {
1476 return *it;
1477 }
1478 }
1479
1480 return nullptr;
1481}
1482
void setFlagValue(bool)
T * asT1() const
bool isT1() const
\inmodule QtCore\reentrant
Definition qdatetime.h:257
\inmodule QtCore \reentrant
Definition qdatetime.h:27
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
const_iterator constBegin() const noexcept
Definition qlist.h:615
void append(parameter_type t)
Definition qlist.h:441
const_iterator constEnd() const noexcept
Definition qlist.h:616
QByteArray methodSignature() const
\inmodule QtCore
const char * typeName() const
Returns the name of this property's type.
\inmodule QtCore
Definition qmetatype.h:320
static constexpr QMetaType fromType()
Definition qmetatype.h:2612
void destruct(void *data) const
constexpr TypeFlags flags() const
Definition qmetatype.h:2628
bool isValid() const
bool equals(const void *lhs, const void *rhs) const
Compares the objects at lhs and rhs for equality.
constexpr const char * name() const
Definition qmetatype.h:2650
void * construct(void *where, const void *copy=nullptr) const
static bool convert(QMetaType fromType, const void *from, QMetaType toType, void *to)
Converts the object at from from fromType to the preallocated space at to typed toType.
QDynamicMetaObjectData * metaObject
Definition qobject.h:77
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:153
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore\reentrant
Definition qpoint.h:214
QObject * idValue(int index) const
bool isValid() const
QQmlNotifier * idValueBindings(int index) const
QQmlEngine * engine() const
static QQmlPropertyCache::ConstPtr ensurePropertyCache(QObject *object)
Definition qqmldata_p.h:252
QQmlPropertyCache::ConstPtr propertyCache
Definition qqmldata_p.h:195
quint32 hasVMEMetaObject
Definition qqmldata_p.h:107
quint32 hasInterceptorMetaObject
Definition qqmldata_p.h:106
static bool wasDeleted(const QObject *)
Definition qqmldata_p.h:312
static QQmlData * get(QObjectPrivate *priv, bool create)
Definition qqmldata_p.h:199
bool hasBindingBit(int) const
Definition qqmldata_p.h:349
void warning(const QQmlError &)
static QQmlEnginePrivate * get(QQmlEngine *e)
void referenceScarceResources()
void dereferenceScarceResources()
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
void setValue(const QVariant &value)
static QQmlGadgetPtrWrapper * instance(QQmlEngine *engine, QMetaType type)
QMetaProperty property(int index) const
void write(QObject *obj, int idx, QQmlPropertyData::WriteFlags flags, int internalIndex=QV4::ReferenceObject::AllProperties) const
QVariant readOnGadget(const QMetaProperty &property) const
void read(QObject *obj, int idx)
void writeOnGadget(const QMetaProperty &property, const QVariant &value)
void setObject(QObject *g)
Definition qqmlguard_p.h:62
int metaCall(QObject *o, QMetaObject::Call c, int id, void **a) override
QQmlPropertyCache::ConstPtr cache
QMetaObject * toDynamicMetaObject(QObject *o) override
QBiPointer< QDynamicMetaObjectData, const QMetaObject > parent
QQmlInterceptorMetaObject(QObject *obj, const QQmlPropertyCache::ConstPtr &cache)
bool intercept(QMetaObject::Call c, int id, void **a)
void registerInterceptor(QQmlPropertyIndex index, QQmlPropertyValueInterceptor *interceptor)
QTaggedPointer< const QMetaObject, MetaObjectValidity > metaObject
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
QObject * object
Definition qqmllist.h:81
static QQmlType qmlListType(QMetaType metaType)
static QQmlValueType * valueType(QMetaType metaType)
static QQmlPropertyCache::ConstPtr propertyCacheForType(QMetaType metaType)
void connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify=true)
QMetaType propType() const
static QQmlPropertyIndex fromEncoded(qint32 encodedIndex)
static void removeBinding(const QQmlProperty &that)
The QQmlPropertyValueInterceptor class is inherited by property interceptors such as Behavior.
bool isSequentialContainer() const
Definition qqmltype.cpp:638
QTaggedPointer< QQmlVMEMetaObject, Tag > metaObject
QV4::ReturnedValue vmeMethod(int index) const
const QV4::CompiledData::Object * compiledObject
int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override
void connectAlias(int aliasId)
QV4::WeakValue propertyAndMethodStorage
QDateTime readPropertyAsDateTime(int id) const
static void list_append(QQmlListProperty< QObject > *prop, QObject *o)
QV4::ReturnedValue readVarProperty(int) const
bool readPropertyAsBool(int id) const
QPointF readPropertyAsPointF(int id) const
static void list_clear_nosignal(QQmlListProperty< QObject > *prop)
QRectF readPropertyAsRectF(int id) const
static QQmlVMEMetaObject * getForSignal(QObject *o, int coreIndex)
QV4::ReturnedValue method(int) const
void mark(QV4::MarkStack *markStack)
QDate readPropertyAsDate(int id) const
QV4::ReturnedValue vmeProperty(int index) const
static void list_clear(QQmlListProperty< QObject > *prop)
double readPropertyAsDouble(int id) const
static void list_append_nosignal(QQmlListProperty< QObject > *prop, QObject *o)
static QQmlVMEMetaObject * get(QObject *o)
QQmlRefPointer< QV4::ExecutableCompilationUnit > compilationUnit
static QQmlVMEMetaObject * getForProperty(QObject *o, int coreIndex)
int readPropertyAsInt(int id) const
void writeProperty(int id, int v)
static QQmlVMEMetaObject * getForMethod(QObject *o, int coreIndex)
QV4::ExecutionEngine * engine
void setVMEProperty(int index, const QV4::Value &v)
QUrl readPropertyAsUrl(int id) const
QString readPropertyAsString(int id) const
QVector< QQmlGuard< QObject > > * readPropertyAsList(int id) const
QQmlVMEVariantQObjectPtr * getQObjectGuardForProperty(int) const
QQmlGuardedContextData ctxt
QSizeF readPropertyAsSizeF(int id) const
QObject * readPropertyAsQObject(int id) const
QList< QQmlVMEVariantQObjectPtr * > varObjectGuards
QVariant readPropertyAsVariant(int) const
QQmlVMEMetaObject * parentVMEMetaObject() const
QQmlVMEMetaObject(QV4::ExecutionEngine *engine, QObject *obj, const QQmlPropertyCache::ConstPtr &cache, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &qmlCompilationUnit, int qmlObjectId)
QTime readPropertyAsTime(int id) const
QQmlVMEMetaObjectEndpoint * aliasEndpoints
void connectAliasSignal(int index, bool indexInSignalRange)
bool aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const
void activate(QObject *, int, void **)
void writeVarProperty(int, const QV4::Value &)
void setVmeMethod(int index, const QV4::Value &function)
QV4::MemberData * propertyAndMethodStorageAsMemberData() const
QVector< QQmlGuard< QObject > > * list() const
QQmlVMEResolvedList(QQmlListProperty< QObject > *prop)
QQmlVMEMetaObject * m_target
void setGuardedValue(QObject *obj, QQmlVMEMetaObject *target, int index)
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore \reentrant
The QSequentialIterable class is an iterable interface for a container in a QVariant.
\inmodule QtCore
Definition qsize.h:207
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5857
T * data() const noexcept
void setTag(Tag tag)
Tag tag() const noexcept
\inmodule QtCore \reentrant
Definition qdatetime.h:189
\inmodule QtCore
Definition qproperty.h:677
\inmodule QtCore
Definition qurl.h:94
const CompiledObject * objectAt(int index) const
Managed * asManaged() const
bool isUndefined() const
Value * valueRef() const
void markOnce(MarkStack *markStack)
void set(ExecutionEngine *engine, const Value &value)
\inmodule QtCore
Definition qvariant.h:64
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:531
Private d
Definition qvariant.h:665
QMetaType metaType() const
const void * constData() const
Definition qvariant.h:446
qDeleteAll(list.begin(), list.end())
double e
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
auto mo
[7]
QList< QVariant > arguments
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
quint64 ReturnedValue
#define Q_UNLIKELY(x)
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
static QDBusError::ErrorType get(const char *name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qWarning
Definition qlogging.h:162
constexpr int qMetaTypeId()
Definition qmetatype.h:1384
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint GLuint end
GLenum GLuint id
[7]
GLdouble GLdouble GLdouble GLdouble top
GLuint object
[3]
GLenum type
GLenum target
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLhandleARB obj
[2]
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint64EXT * result
[6]
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static void list_removeLast(QQmlListProperty< QObject > *prop)
static QMetaObject * stringCastMetaObject(QObject *o, const QMetaObject *top)
static QObject * list_at(QQmlListProperty< QObject > *prop, qsizetype index)
static qsizetype list_count(QQmlListProperty< QObject > *prop)
static void list_replace(QQmlListProperty< QObject > *prop, qsizetype index, QObject *o)
void QQmlVMEMetaObjectEndpoint_callback(QQmlNotifierEndpoint *e, void **)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(*) void arg)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define QStringLiteral(str)
#define sp
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:45
size_t quintptr
Definition qtypes.h:72
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
const char property[13]
Definition qwizard.cpp:101
QObject::connect nullptr
QVariant variant
[1]
QJSValueList args
QJSEngine engine
[0]
virtual void objectDestroyed(QObject *)
Definition qobject_p.h:453
virtual int metaCall(QObject *, QMetaObject::Call, int _id, void **)=0
\inmodule QtCore
QMetaProperty property(int index) const
Returns the meta-data for the property with the given index.
static int metacall(QObject *, Call, int, void **)
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or \nullptr if there is no such object.
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
static void activate(QObject *sender, int signal_index, void **argv)
Definition qobject.cpp:4057
bool hasFlag(Flag flag) const
const Property * propertyTable() const
const Alias * aliasTable() const
static constexpr ReturnedValue undefined()
Heap::String * newString(const QString &s=QString())
QQmlError catchExceptionAsQmlError()
QV4::ReturnedValue fromVariant(const QVariant &)
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols=true)
Heap::Object * newVariantObject(const QMetaType type, const void *data)
ExecutionEngine * engine() const
static Heap::MemberData * allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old=nullptr)
const Value * data() const
void set(EngineBase *e, uint index, Value v)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static constexpr const int AllProperties
static bool readReference(HeapObject *ref)
static HeapObject * detached(HeapObject *ref)
bool hasException() const
ExecutionEngine * engine
static void * getRawContainerPtr(const Sequence *object, QMetaType typeHint)
static ReturnedValue fromData(QV4::ExecutionEngine *engine, QMetaType type, QMetaSequence metaSequence, const void *data)
constexpr ReturnedValue asReturnedValue() const
QV4_NEARLY_ALWAYS_INLINE double doubleValue() const
int integerValue() const
bool isDouble() const
bool isBoolean() const
bool booleanValue() const
static constexpr Value fromInt32(int i)
Definition qv4value_p.h:187
QML_NEARLY_ALWAYS_INLINE String * stringValue() const
Definition qv4value_p.h:55
static constexpr Value fromBoolean(bool b)
Definition qv4value_p.h:183
static constexpr Value undefinedValue()
Definition qv4value_p.h:191
static Value fromDouble(double d)
Definition qv4value_p.h:199
static constexpr Value fromReturnedValue(ReturnedValue val)
Definition qv4value_p.h:165
const T * as() const
Definition qv4value_p.h:132
static constexpr Value nullValue()
Definition qv4value_p.h:195
V4_NEEDS_DESTROY void addVmePropertyReference() const
void removeVmePropertyReference() const
uchar data[MaxInternalSize]
Definition qvariant.h:111
void wrapper()