Skip to content
Permalink
Browse files
[processing] Fix missing fields in data defined expression builder
when input layer is using selected features only

Fixes #40055
  • Loading branch information
nyalldawson committed Jul 21, 2021
1 parent 237394f commit 6d01b322573ea9c2004f57d63233fb7d2ac721e7
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/gui/processing/qgsprocessingwidgetwrapper.cpp
@@ -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 );

0 comments on commit 6d01b32

Please sign in to comment.