6#include <private/qqmlboundsignal_p.h>
7#include <private/qqmlcomponent_p.h>
8#include <private/qqmlobjectcreator_p.h>
9#include <private/qqmlproperty_p.h>
10#include <private/qqmltypeloader_p.h>
11#include <private/qqmlvme_p.h>
12#include <private/qv4functionobject_p.h>
13#include <private/qv4generatorobject_p.h>
14#include <private/qv4qmlcontext_p.h>
15#include <private/qv4resolvedtypereference_p.h>
25 if (QQmlRefPointer<QV4::ExecutableCompilationUnit> cu = m_ddata->compilationUnit)
26 resetBindings(m_object->metaObject(), cu, m_ddata->cuObjectIndex);
28 for (QQmlVMEMetaObject *vmeMeta = m_ddata->hasVMEMetaObject
29 ?
static_cast<QQmlVMEMetaObject *>(QObjectPrivate::get(m_object)->metaObject)
31 vmeMeta; vmeMeta = vmeMeta->parentVMEMetaObject()) {
32 resetBindings(vmeMeta->toDynamicMetaObject(m_object), vmeMeta->compilationUnit(),
33 vmeMeta->qmlObjectId());
37 while (QQmlBoundSignal *signalHandler = m_ddata->signalHandlers)
40 const QHash<QQmlAttachedPropertiesFunc, QObject *> *attachedProperties =
41 m_ddata->hasExtendedData() ? m_ddata->attachedProperties() :
nullptr;
42 const auto isAttached = [attachedProperties](QObject *child) {
43 if (!attachedProperties)
45 for (QObject *attached : *attachedProperties) {
46 if (attached == child)
52 const QObjectList children = m_object->children();
54 for (QObject *child : children) {
58 if (QQmlData *ddata = QQmlData::get(child);
59 ddata && ddata->compilationUnit == m_ddata->compilationUnit) {
60 if (!isAttached(child))
61 child->setParent(
nullptr);
67 const QMetaObject *metaObject,
const QV4::CompiledData::Binding *binding,
68 const QString &defaultPropName,
69 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &oldUnit)
71 if (binding->hasFlag(QV4::CompiledData::Binding::IsCustomParserBinding))
74 const QString name = binding->propertyNameIndex == 0
76 : oldUnit->stringAt(binding->propertyNameIndex);
80 const int propIdx = metaObject->indexOfProperty(name.toUtf8().constData());
81 Q_ASSERT(propIdx >= 0);
83 if (m_handledProperties.contains(propIdx))
86 const QMetaProperty property = metaObject->property(propIdx);
87 const QMetaType type = property.metaType();
89 const QMetaType::TypeFlags flags = type.flags();
90 if (flags.testFlag(QMetaType::IsQmlList)) {
91 QQmlListReference list(m_object, property.name());
93 (
void)m_handledProperties.hasSeen(propIdx);
96 }
else if (flags.testFlag(QMetaType::PointerToQObject) && binding->isGroupProperty()) {
97 QObject *groupObject = property.read(m_object).value<QObject *>();
99 (
void)m_handledProperties.hasSeen(propIdx);
106 .resetBindings(groupObject->metaObject(), oldUnit, binding->value.objectIndex);
110 if ((property.isResettable() && property.reset(m_object))
111 || (property.isWritable() && property.write(m_object, QVariant(type)))) {
112 (
void)m_handledProperties.hasSeen(propIdx);
117 const QMetaObject *metaObject,
118 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &oldUnit,
int cuIndex)
120 const QV4::CompiledData::Object *obj = oldUnit->objectAt(cuIndex);
121 const QQmlPropertyCache::ConstPtr cache = oldUnit->propertyCachesPtr()->at(cuIndex);
122 const QString defaultPropertyName = cache ? cache->defaultPropertyName() : QString();
124 const QV4::CompiledData::Binding *binding = obj->bindingTable();
126 for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
127 if (binding->isAttachedProperty()) {
130 if (!m_ddata->hasExtendedData())
133 QV4::ResolvedTypeReference *typeRef = oldUnit->resolvedType(binding->propertyNameIndex);
135 QQmlAttachedPropertiesFunc func
136 = typeRef->type().attachedPropertiesFunction(oldUnit->engine->typeLoader());
139 if (QObject *attached = m_ddata->attachedProperties()->value(func)) {
140 BindingPatchContext(attached).resetBindings(
141 attached->metaObject(), oldUnit,
142 binding->value.objectIndex);
148 if (binding->isSignalHandler())
151 resetBinding(metaObject, binding, defaultPropertyName, oldUnit);
Combined button and popup list for selecting options.