Skip to content

Commit

Permalink
[Releation reference widget] more coherent method names
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Sep 15, 2014
1 parent 51caaab commit 3bb5f43
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgsrelationreferencewidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ class QgsRelationReferenceWidget : QWidget
void init();

signals:
void relatedFeatureChanged( QVariant );
void foreignKeyChanged( QVariant );
};
18 changes: 9 additions & 9 deletions src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ void QgsRelationReferenceWidget::setRelationEditable( bool editable )
mMapIdentificationButton->setEnabled( editable );
}

void QgsRelationReferenceWidget::setRelatedFeature( const QVariant& value )
void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
{
if ( !value.isValid() || value.isNull() )
{
removeRelatedFeature();
deleteForeignKey();
return;
}

Expand All @@ -210,7 +210,7 @@ void QgsRelationReferenceWidget::setRelatedFeature( const QVariant& value )

if ( !f.isValid() )
{
removeRelatedFeature();
deleteForeignKey();
return;
}

Expand All @@ -236,10 +236,10 @@ void QgsRelationReferenceWidget::setRelatedFeature( const QVariant& value )

highlightFeature( f );
updateAttributeEditorFrame( f );
emit relatedFeatureChanged( foreignKey() );
emit foreignKeyChanged( foreignKey() );
}

void QgsRelationReferenceWidget::removeRelatedFeature()
void QgsRelationReferenceWidget::deleteForeignKey()
{
QVariant nullValue = QSettings().value( "qgis/nullValue", "NULL" );
if ( mReadOnlySelector )
Expand All @@ -266,7 +266,7 @@ void QgsRelationReferenceWidget::removeRelatedFeature()
}

updateAttributeEditorFrame( QgsFeature() );
emit relatedFeatureChanged( QVariant( QVariant::Int ) );
emit foreignKeyChanged( QVariant( QVariant::Int ) );
}

void QgsRelationReferenceWidget::mapToolDeactivated()
Expand Down Expand Up @@ -501,7 +501,7 @@ void QgsRelationReferenceWidget::mapIdentificationTriggered( QAction* action )
{
if ( action == mRemoveFeatureAction )
{
removeRelatedFeature();
deleteForeignKey();
}

else if ( action == mMapIdentificationAction )
Expand Down Expand Up @@ -539,7 +539,7 @@ void QgsRelationReferenceWidget::comboReferenceChanged( int index )
mReferencedLayer->getFeatures( QgsFeatureRequest().setFilterFid( fid ) ).nextFeature( feat );
highlightFeature( feat );
updateAttributeEditorFrame( feat );
emit relatedFeatureChanged( mFidFkMap.value( fid ) );
emit foreignKeyChanged( mFidFkMap.value( fid ) );
}

void QgsRelationReferenceWidget::updateAttributeEditorFrame( const QgsFeature feature )
Expand Down Expand Up @@ -569,7 +569,7 @@ void QgsRelationReferenceWidget::featureIdentified( const QgsFeature& feature )

highlightFeature( feature );
updateAttributeEditorFrame( feature );
emit relatedFeatureChanged( foreignKey() );
emit foreignKeyChanged( foreignKey() );

// deactivate map tool if activate
if ( mCanvas && mMapTool )
Expand Down
6 changes: 3 additions & 3 deletions src/gui/editorwidgets/qgsrelationreferencewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
void setRelationEditable( bool editable );

//! this sets the related feature using from the foreign key
void setRelatedFeature( const QVariant &value );
void setForeignKey( const QVariant &value );

//! returns the related feature foreign key
QVariant foreignKey();
Expand All @@ -73,15 +73,15 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
void init();

signals:
void relatedFeatureChanged( QVariant );
void foreignKeyChanged( QVariant );

private slots:
void highlightActionTriggered( QAction* action );
void deleteHighlight();
void openForm();
void mapIdentificationTriggered( QAction* action );
void comboReferenceChanged( int index );
void removeRelatedFeature();
void deleteForeignKey();
void featureIdentified( const QgsFeature& feature );
void mapToolDeactivated();

Expand Down
6 changes: 3 additions & 3 deletions src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void QgsRelationReferenceWidgetWrapper::initWidget( QWidget* editor )

mWidget->setRelation( relation, config( "AllowNULL" ).toBool() );

connect( mWidget, SIGNAL( relatedFeatureChanged( QVariant ) ), this, SLOT( relatedFeatureChanged( QVariant ) ) );
connect( mWidget, SIGNAL( foreignKeyChanged( QVariant ) ), this, SLOT( foreignKeyChanged( QVariant ) ) );
}

QVariant QgsRelationReferenceWidgetWrapper::value()
Expand All @@ -96,7 +96,7 @@ void QgsRelationReferenceWidgetWrapper::setValue( const QVariant& value )
if ( !mWidget )
return;

mWidget->setRelatedFeature( value );
mWidget->setForeignKey( value );
}

void QgsRelationReferenceWidgetWrapper::setEnabled( bool enabled )
Expand All @@ -107,7 +107,7 @@ void QgsRelationReferenceWidgetWrapper::setEnabled( bool enabled )
mWidget->setRelationEditable( enabled );
}

void QgsRelationReferenceWidgetWrapper::relatedFeatureChanged( QVariant value )
void QgsRelationReferenceWidgetWrapper::foreignKeyChanged( QVariant value )
{
if ( !value.isValid() || value.isNull() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapp
virtual void setEnabled( bool enabled );

private slots:
void relatedFeatureChanged( QVariant value );
void foreignKeyChanged( QVariant value );

private:
QgsRelationReferenceWidget* mWidget;
Expand Down

0 comments on commit 3bb5f43

Please sign in to comment.