App: fix dynamic property undo/redo

Instead of enforce property type match when undo/redo, modify various
property Paste() to make it type safe.
This commit is contained in:
Zheng, Lei
2019-09-30 14:18:40 +08:00
committed by wmayer
parent 890bc90b0c
commit 41387fd991
6 changed files with 37 additions and 24 deletions

View File

@@ -147,17 +147,17 @@ void PropertyExpressionEngine::hasSetValue()
void PropertyExpressionEngine::Paste(const Property &from)
{
const PropertyExpressionEngine * fromee = static_cast<const PropertyExpressionEngine*>(&from);
const PropertyExpressionEngine &fromee = dynamic_cast<const PropertyExpressionEngine&>(from);
AtomicPropertyChange signaller(*this);
expressions.clear();
for(auto &e : fromee->expressions) {
for(auto &e : fromee.expressions) {
expressions[e.first] = ExpressionInfo(
boost::shared_ptr<Expression>(e.second.expression->copy()));
expressionChanged(e.first);
}
validator = fromee->validator;
validator = fromee.validator;
signaller.tryInvoke();
}