Skip to content
Permalink
Browse files

[Releation reference widget] more coherent method names

  • Loading branch information
3nids committed Sep 15, 2014
1 parent 51caaab commit 3bb5f43da57298063397e70eecbdadb7683ac06c
@@ -44,5 +44,5 @@ class QgsRelationReferenceWidget : QWidget
void init();

signals:
void relatedFeatureChanged( QVariant );
void foreignKeyChanged( QVariant );
};
@@ -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;
}

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

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

@@ -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 )
@@ -266,7 +266,7 @@ void QgsRelationReferenceWidget::removeRelatedFeature()
}

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

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

else if ( action == mMapIdentificationAction )
@@ -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 )
@@ -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 )
@@ -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();
@@ -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();

@@ -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()
@@ -96,7 +96,7 @@ void QgsRelationReferenceWidgetWrapper::setValue( const QVariant& value )
if ( !mWidget )
return;

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

void QgsRelationReferenceWidgetWrapper::setEnabled( bool enabled )
@@ -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() )
{
@@ -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;

0 comments on commit 3bb5f43

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