Skip to content
Permalink
Browse files

Merge pull request #8464 from elpaso/bugfix-20455-value-relation-mult…

…iple-rules

Emit valueChanged when a widget value changes as a consequence of ano…

Cherry picked from 798155c
  • Loading branch information
elpaso committed Nov 13, 2018
1 parent ac6d8cd commit ca6c5bab5fa45be8b4389a5703d82d62c3a2de26
@@ -68,7 +68,7 @@ void QgsEditorWidgetWrapper::setEnabled( bool enabled )

void QgsEditorWidgetWrapper::setFeature( const QgsFeature &feature )
{
mFormFeature = feature;
setFormFeature( feature );
setValue( feature.attribute( mFieldIdx ) );
}

@@ -212,6 +212,7 @@ void QgsValueRelationWidgetWrapper::widgetValueChanged( const QString &attribute
// Do nothing if the value has not changed
if ( attributeChanged )
{
QVariant oldValue( value( ) );
setFormFeatureAttribute( attribute, newValue );
// Update combos if the value used in the filter expression has changed
if ( QgsValueRelationFieldFormatter::expressionRequiresFormScope( mExpression )
@@ -220,6 +221,15 @@ void QgsValueRelationWidgetWrapper::widgetValueChanged( const QString &attribute
populate();
// Restore value
setValue( value( ) );
// If the value has changed as a result of another widget's value change,
// we need to emit the signal to make sure other dependent widgets are
// updated.
if ( oldValue != value() && fieldIdx() < formFeature().fields().count() )
{
QString attributeName( formFeature().fields().names().at( fieldIdx() ) );
setFormFeatureAttribute( attributeName, value( ) );
emitValueChanged( );
}
}
}
}

0 comments on commit ca6c5ba

Please sign in to comment.
You can’t perform that action at this time.