Skip to content
Permalink
Browse files

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

…ther widget changed

Fix #20455
  • Loading branch information
elpaso committed Nov 12, 2018
1 parent 9b04a29 commit d479b4dcbc60b9c7b86175078c01c8e244258b38
@@ -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 d479b4d

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