Core: Update expressions on property rename
This includes both expressions in generic containers and in spreadsheets.
This commit is contained in:
committed by
Yorik van Havre
parent
3797e35dbc
commit
8c01d577e7
@@ -53,6 +53,8 @@ PropertyExpressionContainer::PropertyExpressionContainer()
|
||||
inited = true;
|
||||
GetApplication().signalRelabelDocument.connect(
|
||||
PropertyExpressionContainer::slotRelabelDocument);
|
||||
GetApplication().signalRenameDynamicProperty.connect(
|
||||
PropertyExpressionContainer::slotRenameDynamicProperty);
|
||||
}
|
||||
_ExprContainers.insert(this);
|
||||
}
|
||||
@@ -75,6 +77,13 @@ void PropertyExpressionContainer::slotRelabelDocument(const App::Document& doc)
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyExpressionContainer::slotRenameDynamicProperty(const App::Property& prop, const char* oldName)
|
||||
{
|
||||
for (auto container : _ExprContainers) {
|
||||
container->onRenameDynamicProperty(prop, oldName);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct PropertyExpressionEngine::Private
|
||||
@@ -1208,6 +1217,17 @@ void PropertyExpressionEngine::onRelabeledDocument(const App::Document& doc)
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyExpressionEngine::onRenameDynamicProperty(const App::Property& prop, const char* oldName)
|
||||
{
|
||||
ObjectIdentifier oldNameId = ObjectIdentifier(prop.getContainer(), std::string(oldName));
|
||||
ObjectIdentifier newNameId = ObjectIdentifier(prop);
|
||||
const std::map<ObjectIdentifier, ObjectIdentifier> paths = {
|
||||
{oldNameId, newNameId},
|
||||
};
|
||||
|
||||
renameObjectIdentifiers(paths);
|
||||
}
|
||||
|
||||
void PropertyExpressionEngine::getLinksTo(std::vector<App::ObjectIdentifier>& identifiers,
|
||||
App::DocumentObject* obj,
|
||||
const char* subname,
|
||||
|
||||
Reference in New Issue
Block a user