Skip to content

Commit

Permalink
properly get layer from a QgsProcessingFeatureSourceDefinition (qgis#…
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 authored and nyalldawson committed Feb 19, 2021
1 parent 20024d8 commit 6b6cfa4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 6b6cfa4

Please sign in to comment.