Skip to content

Commit

Permalink
Add undo/redo to links
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinBuira committed Jan 28, 2025
1 parent 965d36a commit 59e103e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gui/processing/models/qgsmodelviewtoollink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void QgsModelViewToolLink::modelReleaseEvent( QgsModelViewMouseEvent *event )
return;
}

emit view()->beginCommand("Edit link");

QList<QgsProcessingModelChildParameterSource> sources;

Expand Down Expand Up @@ -166,6 +167,7 @@ void QgsModelViewToolLink::modelReleaseEvent( QgsModelViewMouseEvent *event )
//We need to pass the update child algorithm to the model
scene()->model()->setChildAlgorithm(*child_to);

emit view()->endCommand();
// Redraw
emit scene()->rebuildRequired();

Expand Down Expand Up @@ -251,12 +253,14 @@ void QgsModelViewToolLink::setFromSocket(QgsModelDesignerSocketGraphicItem *sock
}
if (output_socket->index() == _alg->algorithm()->outputDefinitionIndex(source.outputName()) ){
mFrom = output_socket;
emit view()->beginCommand("Edit link");
}
}
else if ( QgsProcessingModelParameter *_param = dynamic_cast<QgsProcessingModelParameter *>( output_socket->component() ) ){
if ( source.parameterName() == _param->parameterName()) {
mFrom = output_socket;
}
if ( source.parameterName() == _param->parameterName()) {
mFrom = output_socket;
emit view()->beginCommand("Edit link");
}
}
}
}
Expand Down

0 comments on commit 59e103e

Please sign in to comment.