Skip to content

Commit 6b2d44a

Browse files
authored
Merge pull request #8478 from elpaso/value-relation-backport
Merge pull request #8464 from elpaso/bugfix-20455-value-relation-mult…
2 parents ac6d8cd + ca6c5ba commit 6b2d44a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void QgsEditorWidgetWrapper::setEnabled( bool enabled )
6868

6969
void QgsEditorWidgetWrapper::setFeature( const QgsFeature &feature )
7070
{
71-
mFormFeature = feature;
71+
setFormFeature( feature );
7272
setValue( feature.attribute( mFieldIdx ) );
7373
}
7474

src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ void QgsValueRelationWidgetWrapper::widgetValueChanged( const QString &attribute
212212
// Do nothing if the value has not changed
213213
if ( attributeChanged )
214214
{
215+
QVariant oldValue( value( ) );
215216
setFormFeatureAttribute( attribute, newValue );
216217
// Update combos if the value used in the filter expression has changed
217218
if ( QgsValueRelationFieldFormatter::expressionRequiresFormScope( mExpression )
@@ -220,6 +221,15 @@ void QgsValueRelationWidgetWrapper::widgetValueChanged( const QString &attribute
220221
populate();
221222
// Restore value
222223
setValue( value( ) );
224+
// If the value has changed as a result of another widget's value change,
225+
// we need to emit the signal to make sure other dependent widgets are
226+
// updated.
227+
if ( oldValue != value() && fieldIdx() < formFeature().fields().count() )
228+
{
229+
QString attributeName( formFeature().fields().names().at( fieldIdx() ) );
230+
setFormFeatureAttribute( attributeName, value( ) );
231+
emitValueChanged( );
232+
}
223233
}
224234
}
225235
}

0 commit comments

Comments
 (0)