Skip to content
Permalink
Browse files

Avoid recursion in ValueRelation widget

Fix #17521
  • Loading branch information
m-kuhn committed Nov 23, 2017
1 parent cfbb5d7 commit 09cffcd008816401a6606b8f4c3a2cd63811fc67
@@ -43,7 +43,7 @@ QgsValueRelationWidgetWrapper::QgsValueRelationWidgetWrapper( QgsVectorLayer* vl
, mListWidget( nullptr )
, mLineEdit( nullptr )
, mLayer( nullptr )
, mUpdating( false )
, mEnabled( false )
{
}

@@ -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 );
@@ -267,7 +268,6 @@ void QgsValueRelationWidgetWrapper::setEnabled( bool enabled )
else
item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
}
mUpdating = false;
}
else
QgsEditorWidgetWrapper::setEnabled( enabled );
@@ -86,7 +86,7 @@ class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
ValueRelationCache mCache;
QgsVectorLayer* mLayer;

bool mUpdating;
bool mEnabled;

friend class QgsValueRelationWidgetFactory;
friend class TestQgsValueRelationWidgetWrapper;

0 comments on commit 09cffcd

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