Skip to content
Permalink
Browse files

Update constraints when foreign key is manually updated with empty st…

…ring
  • Loading branch information
pblottiere committed Nov 30, 2017
1 parent 10b34b9 commit 512acca72277923f61cc4f88d0829f619ec9d2fd
@@ -164,7 +164,7 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
connect( mMapIdentificationButton, SIGNAL( clicked() ), this, SLOT( mapIdentification() ) );
connect( mRemoveFKButton, SIGNAL( clicked() ), this, SLOT( deleteForeignKey() ) );
connect( mAddEntryButton, SIGNAL( clicked( bool ) ), this, SLOT( addEntry() ) );
connect( mComboBox, SIGNAL( editTextChanged( QString ) ), this, SLOT( updateAddEntryButton() ) );
connect( mComboBox, SIGNAL( editTextChanged( QString ) ), this, SLOT( editTextUpdated( const QString & ) ) );
}

QgsRelationReferenceWidget::~QgsRelationReferenceWidget()
@@ -990,3 +990,13 @@ void QgsRelationReferenceWidget::disableChainedComboBoxes( const QComboBox *scb
ccb = cb;
}
}

void QgsRelationReferenceWidget::editTextUpdated( const QString &text )
{
updateAddEntryButton();

// allow to raise an invalid constraint on NULL values if necessary
// and when the combobox is updated manually from the keyboard
if ( text.isEmpty() && mAllowNull )
mComboBox->setCurrentIndex( 0 );
}
@@ -157,12 +157,13 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
void mapToolDeactivated();
void filterChanged();
void addEntry();
void updateAddEntryButton();
void editTextUpdated( const QString &text );

private:
void highlightFeature( QgsFeature f = QgsFeature(), CanvasExtent canvasExtent = Fixed );
void updateAttributeEditorFrame( const QgsFeature& feature );
void disableChainedComboBoxes( const QComboBox *scb );
void updateAddEntryButton();

// initialized
QgsAttributeEditorContext mEditorContext;

0 comments on commit 512acca

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