Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-3_34] [GUI] Avoid endless stack of signal emission between QgsFilterLineEdit::valueChanged and QgsValueRelationWidgetWrapper::updateValues() #55986

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget *editor )
{
connect( filterLineEdit, &QgsFilterLineEdit::valueChanged, this, [ = ]( const QString & )
{
emitValueChanged();
if ( mSubWidgetSignalBlocking == 0 )
emitValueChanged();
} );
}
else
Expand Down Expand Up @@ -399,6 +400,7 @@ void QgsValueRelationWidgetWrapper::updateValues( const QVariant &value, const Q
}
else if ( mLineEdit )
{
mSubWidgetSignalBlocking ++;
mLineEdit->clear();
bool wasFound { false };
for ( const QgsValueRelationFieldFormatter::ValueRelationItem &i : std::as_const( mCache ) )
Expand All @@ -415,6 +417,7 @@ void QgsValueRelationWidgetWrapper::updateValues( const QVariant &value, const Q
{
mLineEdit->setText( tr( "(no selection)" ) );
}
mSubWidgetSignalBlocking --;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
QgsToolTipComboBox *mComboBox = nullptr;
QgsFilteredTableWidget *mTableWidget = nullptr;
QLineEdit *mLineEdit = nullptr;
int mSubWidgetSignalBlocking = 0; //! Set to non-zero when a endless loop of notifications could happen.

QgsValueRelationFieldFormatter::ValueRelationCache mCache;
QgsVectorLayer *mLayer = nullptr;
Expand Down
Loading