Skip to content

Commit

Permalink
[processing] Fix missing fields in data defined expression builder
Browse files Browse the repository at this point in the history
when input layer is using selected features only

Fixes #40055
  • Loading branch information
nyalldawson authored and nirvn committed Jul 19, 2021
1 parent 5566654 commit 3164ede
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/processing/qgsprocessingwidgetwrapper.cpp
Expand Up @@ -331,7 +331,15 @@ void QgsAbstractProcessingParameterWidgetWrapper::setDynamicParentLayerParameter
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 )
{
mPropertyButton->setVectorLayer( nullptr );
Expand Down

0 comments on commit 3164ede

Please sign in to comment.