Skip to content

Commit

Permalink
[processing] Don't show model child algorithm outputs as choices
Browse files Browse the repository at this point in the history
for multi-layer input parameters when running a model

These should only be shown when the parameter widget is being
used to edit a child algorithm

Fixes #41210
  • Loading branch information
nyalldawson committed Jun 8, 2021
1 parent 3cba518 commit f4477b2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -6511,14 +6511,17 @@ void QgsProcessingMultipleLayerPanelWidget::setValue( const QVariant &value )
void QgsProcessingMultipleLayerPanelWidget::setProject( QgsProject *project )
{
mProject = project;
connect( mProject, &QgsProject::layerRemoved, this, [&]( const QString & layerId )
if ( mProject )
{
if ( mValue.removeAll( layerId ) )
connect( mProject, &QgsProject::layerRemoved, this, [&]( const QString & layerId )
{
updateSummaryText();
emit changed();
}
} );
if ( mValue.removeAll( layerId ) )
{
updateSummaryText();
emit changed();
}
} );
}
}

void QgsProcessingMultipleLayerPanelWidget::setModel( QgsProcessingModelAlgorithm *model, const QString &modelChildAlgorithmID )
Expand Down Expand Up @@ -6725,7 +6728,8 @@ QWidget *QgsProcessingMultipleLayerWidgetWrapper::createWidget()
mPanel = new QgsProcessingMultipleLayerPanelWidget( nullptr, layerParam );
mPanel->setToolTip( parameterDefinition()->toolTip() );
mPanel->setProject( widgetContext().project() );
mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
if ( type() == QgsProcessingGui::Modeler )
mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
connect( mPanel, &QgsProcessingMultipleLayerPanelWidget::changed, this, [ = ]
{
emit widgetValueHasChanged( this );
Expand All @@ -6739,7 +6743,8 @@ void QgsProcessingMultipleLayerWidgetWrapper::setWidgetContext( const QgsProcess
if ( mPanel )
{
mPanel->setProject( context.project() );
mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
if ( type() == QgsProcessingGui::Modeler )
mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
}
}

Expand Down

0 comments on commit f4477b2

Please sign in to comment.