23QgsModelUndoCommand::QgsModelUndoCommand( QgsProcessingModelAlgorithm *model,
const QString &text,
int id, QUndoCommand *parent )
24 : QUndoCommand( text, parent )
28 mBeforeState = model->toVariant();
31void QgsModelUndoCommand::saveAfterState()
33 mAfterState = mModel->toVariant();
36int QgsModelUndoCommand::id()
const
41void QgsModelUndoCommand::undo()
46 const QVariantMap params = mModel->designerParameterValues();
48 mModel->loadVariant( mBeforeState );
50 mModel->setDesignerParameterValues( params );
53void QgsModelUndoCommand::redo()
63 const QVariantMap params = mModel->designerParameterValues();
65 mModel->loadVariant( mAfterState );
67 mModel->setDesignerParameterValues( params );
70bool QgsModelUndoCommand::mergeWith(
const QUndoCommand *other )
72 if ( other->id() == 0 || other->id() != mId )
75 if (
const QgsModelUndoCommand *
c =
dynamic_cast<const QgsModelUndoCommand *
>( other ) )
77 mAfterState =
c->mAfterState;
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c