Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid recursion in ValueRelation widget
Fix #17521
  • Loading branch information
m-kuhn committed Nov 23, 2017
1 parent cfbb5d7 commit 09cffcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
Expand Up @@ -43,7 +43,7 @@ QgsValueRelationWidgetWrapper::QgsValueRelationWidgetWrapper( QgsVectorLayer* vl
, mListWidget( nullptr )
, mLineEdit( nullptr )
, mLayer( nullptr )
, mUpdating( false )
, mEnabled( false )
{
}

Expand Down Expand Up @@ -252,12 +252,13 @@ void QgsValueRelationWidgetWrapper::showIndeterminateState()

void QgsValueRelationWidgetWrapper::setEnabled( bool enabled )
{
if ( mUpdating )
if ( mEnabled == enabled )
return;

mEnabled = enabled;

if ( mListWidget )
{
mUpdating = true;
for ( int i = 0; i < mListWidget->count(); ++i )
{
QListWidgetItem *item = mListWidget->item( i );
Expand All @@ -267,7 +268,6 @@ void QgsValueRelationWidgetWrapper::setEnabled( bool enabled )
else
item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
}
mUpdating = false;
}
else
QgsEditorWidgetWrapper::setEnabled( enabled );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h
Expand Up @@ -86,7 +86,7 @@ class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
ValueRelationCache mCache;
QgsVectorLayer* mLayer;

bool mUpdating;
bool mEnabled;

friend class QgsValueRelationWidgetFactory;
friend class TestQgsValueRelationWidgetWrapper;
Expand Down

0 comments on commit 09cffcd

Please sign in to comment.