Skip to content
Permalink
Browse files

properly get layer from a QgsProcessingFeatureSourceDefinition (#41457)

Fixes #40055
  • Loading branch information
troopa81 authored and github-actions committed Feb 11, 2021
1 parent dbd1c41 commit 35d313ff3f6902822679520714a1405fd1e926cc
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
@@ -2002,7 +2002,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 35d313f

Please sign in to comment.