forked from qt-creator/qt-creator
QmlDesigner: Add Model::bindingPropertiesAboutToBeChanged
It is sometime quite useful to know the old value. For example to remove it. We could add add the old values to the bindingPropertiesChanged but this would be a much larger change. Change-Id: I9b4a78602a35766c99092892b61173fc5c439978 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -205,6 +205,7 @@ public:
|
||||
virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
|
||||
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList);
|
||||
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void bindingPropertiesAboutToBeChanged(const QList<BindingProperty> &propertyList);
|
||||
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange);
|
||||
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||
|
@@ -329,6 +329,8 @@ void AbstractView::variantPropertiesChanged(const QList<VariantProperty>& /*prop
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::bindingPropertiesAboutToBeChanged(const QList<BindingProperty> &) {}
|
||||
|
||||
void AbstractView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/)
|
||||
{
|
||||
}
|
||||
|
@@ -767,6 +767,21 @@ void ModelPrivate::notifyNodeIdChanged(const InternalNodePointer &node,
|
||||
});
|
||||
}
|
||||
|
||||
void ModelPrivate::notifyBindingPropertiesAboutToBeChanged(
|
||||
const QList<InternalBindingPropertyPointer> &internalPropertyList)
|
||||
{
|
||||
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
||||
QList<BindingProperty> propertyList;
|
||||
for (const InternalBindingPropertyPointer &bindingProperty : internalPropertyList) {
|
||||
propertyList.append(BindingProperty(bindingProperty->name(),
|
||||
bindingProperty->propertyOwner(),
|
||||
m_model,
|
||||
view));
|
||||
}
|
||||
view->bindingPropertiesAboutToBeChanged(propertyList);
|
||||
});
|
||||
}
|
||||
|
||||
void ModelPrivate::notifyBindingPropertiesChanged(
|
||||
const QList<InternalBindingPropertyPointer> &internalPropertyList,
|
||||
AbstractView::PropertyChangeFlags propertyChange)
|
||||
@@ -1030,6 +1045,7 @@ void ModelPrivate::setBindingProperty(const InternalNodePointer &node, const Pro
|
||||
}
|
||||
|
||||
InternalBindingPropertyPointer bindingProperty = node->bindingProperty(name);
|
||||
notifyBindingPropertiesAboutToBeChanged({bindingProperty});
|
||||
bindingProperty->setExpression(expression);
|
||||
notifyBindingPropertiesChanged({bindingProperty}, propertyChange);
|
||||
}
|
||||
@@ -1087,6 +1103,7 @@ void ModelPrivate::setDynamicBindingProperty(const InternalNodePointer &node,
|
||||
}
|
||||
|
||||
InternalBindingPropertyPointer bindingProperty = node->bindingProperty(name);
|
||||
notifyBindingPropertiesAboutToBeChanged({bindingProperty});
|
||||
bindingProperty->setDynamicExpression(dynamicPropertyType, expression);
|
||||
notifyBindingPropertiesChanged({bindingProperty}, propertyChange);
|
||||
}
|
||||
|
@@ -149,6 +149,8 @@ public:
|
||||
|
||||
void notifyPropertiesRemoved(const QList<PropertyPair> &propertyList);
|
||||
void notifyPropertiesAboutToBeRemoved(const QList<InternalPropertyPointer> &internalPropertyList);
|
||||
void notifyBindingPropertiesAboutToBeChanged(
|
||||
const QList<InternalBindingPropertyPointer> &internalPropertyList);
|
||||
void notifyBindingPropertiesChanged(const QList<InternalBindingPropertyPointer> &internalPropertyList, AbstractView::PropertyChangeFlags propertyChange);
|
||||
void notifySignalHandlerPropertiesChanged(const QVector<InternalSignalHandlerPropertyPointer> &propertyList, AbstractView::PropertyChangeFlags propertyChange);
|
||||
void notifyVariantPropertiesChanged(const InternalNodePointer &node, const PropertyNameList &propertyNameList, AbstractView::PropertyChangeFlags propertyChange);
|
||||
|
Reference in New Issue
Block a user