Skip to content
Permalink
Browse files

properly get layer from a QgsProcessingFeatureSourceDefinition (#41457)

Fixes #40055
  • Loading branch information
troopa81 authored and nyalldawson committed Feb 19, 2021
1 parent 8bab4c5 commit fb032754dd2fa6cb75dd3af72c4be219850c7b43
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
@@ -2005,7 +2005,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 fb03275

Please sign in to comment.