17 #include "qgsprocessingmodelalgorithm.h"
21 QgsModelUndoCommand::QgsModelUndoCommand( QgsProcessingModelAlgorithm *model,
const QString &text,
int id, QUndoCommand *parent )
22 : QUndoCommand( text, parent )
26 mBeforeState = model->toVariant();
29 void QgsModelUndoCommand::saveAfterState()
31 mAfterState = mModel->toVariant();
34 int QgsModelUndoCommand::id()
const
39 void QgsModelUndoCommand::undo()
44 const QVariantMap params = mModel->designerParameterValues();
46 mModel->loadVariant( mBeforeState );
48 mModel->setDesignerParameterValues( params );
51 void QgsModelUndoCommand::redo()
61 const QVariantMap params = mModel->designerParameterValues();
63 mModel->loadVariant( mAfterState );
65 mModel->setDesignerParameterValues( params );
68 bool QgsModelUndoCommand::mergeWith(
const QUndoCommand *other )
70 if ( other->id() == 0 || other->id() != mId )
73 if (
const QgsModelUndoCommand *
c =
dynamic_cast<const QgsModelUndoCommand *
>( other ) )
75 mAfterState =
c->mAfterState;