QDeclarativeAbstractBinding * QDeclarativePropertyPrivate::setBinding(QObject *object, int coreIndex, int valueTypeIndex, QDeclarativeAbstractBinding *newBinding, WriteFlags flags) { QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, 0 != newBinding); QDeclarativeAbstractBinding *binding = 0; if (data && data->hasBindingBit(coreIndex)) { binding = data->bindings; while (binding && binding->propertyIndex() != coreIndex) binding = binding->m_nextBinding; } if (binding && valueTypeIndex != -1 && binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy) { int index = coreIndex | (valueTypeIndex << 24); binding = static_cast<QDeclarativeValueTypeProxyBinding *>(binding)->binding(index); } if (binding) binding->setEnabled(false); if (newBinding) newBinding->setEnabled(true, flags); return binding; }
QDeclarativeValueTypeProxyBinding::~QDeclarativeValueTypeProxyBinding() { while (m_bindings) { QDeclarativeAbstractBinding *binding = m_bindings; binding->setEnabled(false, 0); binding->destroy(); } }
void ObjectNodeInstance::doResetProperty(const QString &propertyName) { m_modelAbstractPropertyHash.remove(propertyName); QDeclarativeProperty property(object(), propertyName, context()); if (!property.isValid()) return; QVariant oldValue = property.read(); if (oldValue.type() == QVariant::Url) { QUrl url = oldValue.toUrl(); QString path = url.toLocalFile(); if (QFileInfo(path).exists() && nodeInstanceView()) nodeInstanceView()->removeFilePropertyFromFileSystemWatcher(object(), propertyName, path); } QDeclarativeAbstractBinding *binding = QDeclarativePropertyPrivate::binding(property); if (binding) { binding->setEnabled(false, 0); binding->destroy(); } if (property.isResettable()) { property.reset(); } else if (property.propertyTypeCategory() == QDeclarativeProperty::List) { QDeclarativeListReference list = qvariant_cast<QDeclarativeListReference>(property.read()); if (!hasFullImplementedListInterface(list)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } list.clear(); } else if (property.isWritable()) { if (property.read() == resetValue(propertyName)) return; property.write(resetValue(propertyName)); } }