mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Add Run Selected option to right click menu for selected algorithms
This commit is contained in:
parent
e6fb69c41e
commit
2f5ad6b51f
@ -407,6 +407,13 @@ Sets the ``results`` obtained for this child algorithm for the last model execut
|
||||
%Docstring
|
||||
Emitted when the user opts to run the model from this child algorithm.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
void runSelected();
|
||||
%Docstring
|
||||
Emitted when the user opts to run selected steps from the model.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
|
@ -172,6 +172,13 @@ Emitted whenever a component of the model is changed.
|
||||
%Docstring
|
||||
Emitted whenever the selected item changes.
|
||||
If ``None``, no item is selected.
|
||||
%End
|
||||
|
||||
void runSelected();
|
||||
%Docstring
|
||||
Emitted when the user opts to run selected steps from the model.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
void runFromChild( const QString &childId );
|
||||
|
@ -407,6 +407,13 @@ Sets the ``results`` obtained for this child algorithm for the last model execut
|
||||
%Docstring
|
||||
Emitted when the user opts to run the model from this child algorithm.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
void runSelected();
|
||||
%Docstring
|
||||
Emitted when the user opts to run selected steps from the model.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
|
@ -172,6 +172,13 @@ Emitted whenever a component of the model is changed.
|
||||
%Docstring
|
||||
Emitted whenever the selected item changes.
|
||||
If ``None``, no item is selected.
|
||||
%End
|
||||
|
||||
void runSelected();
|
||||
%Docstring
|
||||
Emitted when the user opts to run selected steps from the model.
|
||||
|
||||
.. versionadded:: 3.38
|
||||
%End
|
||||
|
||||
void runFromChild( const QString &childId );
|
||||
|
@ -870,9 +870,18 @@ QgsModelChildAlgorithmGraphicItem::QgsModelChildAlgorithmGraphicItem( QgsProcess
|
||||
void QgsModelChildAlgorithmGraphicItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
|
||||
{
|
||||
QMenu *popupmenu = new QMenu( event->widget() );
|
||||
|
||||
if ( isSelected() )
|
||||
{
|
||||
QAction *runSelectedStepsAction = popupmenu->addAction( QObject::tr( "Run Selected Steps…" ) );
|
||||
runSelectedStepsAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionStart.svg" ) ) );
|
||||
connect( runSelectedStepsAction, &QAction::triggered, this, &QgsModelChildAlgorithmGraphicItem::runSelected );
|
||||
}
|
||||
|
||||
QAction *runFromHereAction = popupmenu->addAction( QObject::tr( "Run from Here…" ) );
|
||||
runFromHereAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionStart.svg" ) ) );
|
||||
connect( runFromHereAction, &QAction::triggered, this, &QgsModelChildAlgorithmGraphicItem::runFromHere );
|
||||
|
||||
popupmenu->addSeparator();
|
||||
|
||||
QAction *removeAction = popupmenu->addAction( QObject::tr( "Remove" ) );
|
||||
|
@ -475,6 +475,13 @@ class GUI_EXPORT QgsModelChildAlgorithmGraphicItem : public QgsModelComponentGra
|
||||
*/
|
||||
void runFromHere();
|
||||
|
||||
/**
|
||||
* Emitted when the user opts to run selected steps from the model.
|
||||
*
|
||||
* \since QGIS 3.38
|
||||
*/
|
||||
void runSelected();
|
||||
|
||||
/**
|
||||
* Emitted when the user opts to view previous results from this child algorithm.
|
||||
*
|
||||
|
@ -514,6 +514,7 @@ void QgsModelDesignerDialog::setModelScene( QgsModelGraphicsScene *scene )
|
||||
connect( mScene, &QgsModelGraphicsScene::componentAboutToChange, this, [ = ]( const QString & description, int id ) { beginUndoCommand( description, id ); } );
|
||||
connect( mScene, &QgsModelGraphicsScene::componentChanged, this, [ = ] { endUndoCommand(); } );
|
||||
connect( mScene, &QgsModelGraphicsScene::runFromChild, this, &QgsModelDesignerDialog::runFromChild );
|
||||
connect( mScene, &QgsModelGraphicsScene::runSelected, this, &QgsModelDesignerDialog::runSelectedSteps );
|
||||
connect( mScene, &QgsModelGraphicsScene::showChildAlgorithmOutputs, this, &QgsModelDesignerDialog::showChildAlgorithmOutputs );
|
||||
connect( mScene, &QgsModelGraphicsScene::showChildAlgorithmLog, this, &QgsModelDesignerDialog::showChildAlgorithmLog );
|
||||
|
||||
|
@ -149,6 +149,7 @@ void QgsModelGraphicsScene::createItems( QgsProcessingModelAlgorithm *model, Qgs
|
||||
{
|
||||
emit runFromChild( childId );
|
||||
} );
|
||||
connect( item, &QgsModelChildAlgorithmGraphicItem::runSelected, this, &QgsModelGraphicsScene::runSelected );
|
||||
connect( item, &QgsModelChildAlgorithmGraphicItem::showPreviousResults, this, [this, childId]
|
||||
{
|
||||
emit showChildAlgorithmOutputs( childId );
|
||||
|
@ -187,6 +187,13 @@ class GUI_EXPORT QgsModelGraphicsScene : public QGraphicsScene
|
||||
*/
|
||||
void selectedItemChanged( QgsModelComponentGraphicItem *selected );
|
||||
|
||||
/**
|
||||
* Emitted when the user opts to run selected steps from the model.
|
||||
*
|
||||
* \since QGIS 3.38
|
||||
*/
|
||||
void runSelected();
|
||||
|
||||
/**
|
||||
* Emitted when the user opts to run the part of the model starting from the specified child algorithm.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user