Skip to content
Permalink
Browse files

Do not search data in case of an invalid feature

  • Loading branch information
pblottiere committed Nov 29, 2017
1 parent 3f65a9c commit 042e26726ff1e5eeaab8034b3017e6dcc6fd3f8a
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -583,8 +583,14 @@ void QgsRelationReferenceWidget::init()
}
}

QVariant featId = mFeature.isValid() ? mFeature.id() : QVariant( QVariant::Int );
mComboBox->setCurrentIndex( mComboBox->findData( featId, QgsAttributeTableModel::FeatureIdRole ) );
if ( mFeature.isValid() )
{
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );
}
else
{
mComboBox->setCurrentIndex( -1 );
}

// Only connect after iterating, to have only one iterator on the referenced table at once
connect( mComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( comboReferenceChanged( int ) ) );

0 comments on commit 042e267

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