Skip to content
Permalink
Browse files

properly get layer from a QgsProcessingFeatureSourceDefinition (#41457)

Fixes #40055
  • Loading branch information
troopa81 committed Feb 11, 2021
1 parent 8eb93c5 commit e9de56a83bc440d3207489bc4ddeb53a751eaa45
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
@@ -2008,7 +2008,15 @@ void QgsProcessingExpressionWidgetWrapper::setParentLayerWrapperValue( const Qgs
context = tmpContext.get();
}

QgsVectorLayer *layer = QgsProcessingParameters::parameterAsVectorLayer( parentWrapper->parameterDefinition(), parentWrapper->parameterValue(), *context );
QVariant val = parentWrapper->parameterValue();
if ( val.canConvert<QgsProcessingFeatureSourceDefinition>() )
{
// input is a QgsProcessingFeatureSourceDefinition - get extra properties from it
QgsProcessingFeatureSourceDefinition fromVar = qvariant_cast<QgsProcessingFeatureSourceDefinition>( val );
val = fromVar.source;
}

QgsVectorLayer *layer = QgsProcessingParameters::parameterAsVectorLayer( parentWrapper->parameterDefinition(), val, *context );
if ( !layer )
{
if ( mFieldExpWidget )

0 comments on commit e9de56a

Please sign in to comment.