Spreadsheet: Allow alias removed by undo to be reused

Fixes issue descripted in the forum post:
https://forum.freecadweb.org/viewtopic.php?f=3&t=54009
This commit is contained in:
Benjamin Nauck
2021-01-22 02:58:47 +01:00
committed by wmayer
parent 1fb4e38e5e
commit aa91457491

View File

@@ -503,15 +503,22 @@ void Cell::setAlias(const std::string &n)
owner->revAliasProp.erase(alias);
alias = n;
// Update owner
if (alias != "") {
if (!n.empty()) {
owner->aliasProp[address] = n;
owner->revAliasProp[n] = address;
}
else
else {
owner->aliasProp.erase(address);
}
if (!alias.empty()) {
// The property may have been added in Sheet::updateAlias
auto * docObj = static_cast<App::DocumentObject*>(owner->getContainer());
docObj->removeDynamicProperty(alias.c_str());
}
alias = n;
setUsed(ALIAS_SET, !alias.empty());
setDirty();