QmlDesigner: Add transaction to deleteDynamicPropertyByRow()

Change-Id: Iebbd127ba43698b82e7f7124c5b929e406687f22
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2022-07-07 19:04:30 +02:00
parent 0caa9b4cee
commit 8953be1d3f

View File

@@ -417,16 +417,18 @@ QStringList DynamicPropertiesModel::possibleSourceProperties(const BindingProper
void DynamicPropertiesModel::deleteDynamicPropertyByRow(int rowNumber)
{
BindingProperty bindingProperty = bindingPropertyForRow(rowNumber);
if (bindingProperty.isValid()) {
bindingProperty.parentModelNode().removeProperty(bindingProperty.name());
}
connectionView()->executeInTransaction("DynamicPropertiesModel::deleteDynamicPropertyByRow", [this, rowNumber]() {
BindingProperty bindingProperty = bindingPropertyForRow(rowNumber);
if (bindingProperty.isValid()) {
bindingProperty.parentModelNode().removeProperty(bindingProperty.name());
}
VariantProperty variantProperty = variantPropertyForRow(rowNumber);
VariantProperty variantProperty = variantPropertyForRow(rowNumber);
if (variantProperty.isValid()) {
variantProperty.parentModelNode().removeProperty(variantProperty.name());
}
if (variantProperty.isValid()) {
variantProperty.parentModelNode().removeProperty(variantProperty.name());
}
});
resetModel();
}