23QgsModelUndoCommand::QgsModelUndoCommand( QgsProcessingModelAlgorithm *model,
const QString &text, CommandOperation
id, QUndoCommand *parent )
24 : QUndoCommand( text, parent )
28 mBeforeState = model->toVariant();
31QgsModelUndoCommand::QgsModelUndoCommand( QgsProcessingModelAlgorithm *model,
const QString &text,
const QString &idString, QUndoCommand *parent )
32 : QgsModelUndoCommand( model, text, CommandOperation::
Unknown, parent )
37void QgsModelUndoCommand::saveAfterState()
39 mAfterState = mModel->toVariant();
42int QgsModelUndoCommand::id()
const
50void QgsModelUndoCommand::undo()
55 const QVariantMap params = mModel->designerParameterValues();
57 mModel->loadVariant( mBeforeState );
59 mModel->setDesignerParameterValues( params );
62void QgsModelUndoCommand::redo()
72 const QVariantMap params = mModel->designerParameterValues();
74 mModel->loadVariant( mAfterState );
76 mModel->setDesignerParameterValues( params );
79bool QgsModelUndoCommand::mergeWith(
const QUndoCommand *other )
81 if (
const QgsModelUndoCommand *
c =
dynamic_cast<const QgsModelUndoCommand *
>( other ) )
83 bool canMerge =
false;
84 if ( !
c->idString().isEmpty() &&
c->idString() == mIdString )
88 else if (
c->operation() != CommandOperation::Unknown &&
c->operation() == mOperation )
96 mAfterState =
c->mAfterState;
@ Unknown
Unknown/invalid format.
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