Skip to content
Permalink
Browse files
[processing] Don't show model child algorithm outputs as choices
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 f4477b2cc4f29553ceb8c3d2d82139bc955ffd0c
Showing with 13 additions and 8 deletions.
  1. +13 −8 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
@@ -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 )
@@ -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 );
@@ -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() );
}
}

0 comments on commit f4477b2

Please sign in to comment.