Skip to content

Commit

Permalink
Replace another expresion with createFieldEqualityExpression, remove …
Browse files Browse the repository at this point in the history
…unused variables
  • Loading branch information
nyalldawson committed Jul 6, 2017
1 parent 963e25e commit 29c4fcf
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/core/qgsrelation.cpp
Expand Up @@ -168,8 +168,6 @@ QString QgsRelation::getRelatedFeaturesFilter( const QgsFeature &feature ) const

Q_FOREACH ( const QgsRelation::FieldPair &fieldPair, mFieldPairs )
{
int referencingIdx = referencingLayer()->fields().indexFromName( fieldPair.referencingField() );
QgsField referencingField = referencingLayer()->fields().at( referencingIdx );
QVariant val( feature.attribute( fieldPair.referencedField() ) );
conditions << QgsExpression::createFieldEqualityExpression( fieldPair.referencingField(), val );
}
Expand All @@ -183,12 +181,8 @@ QgsFeatureRequest QgsRelation::getReferencedFeatureRequest( const QgsAttributes

Q_FOREACH ( const QgsRelation::FieldPair &fieldPair, mFieldPairs )
{
int referencedIdx = referencedLayer()->fields().indexFromName( fieldPair.referencedField() );
int referencingIdx = referencingLayer()->fields().indexFromName( fieldPair.referencingField() );

QgsField referencedField = referencedLayer()->fields().at( referencedIdx );

conditions << QStringLiteral( "%1 = %2" ).arg( QgsExpression::quotedColumnRef( fieldPair.referencedField() ), QgsExpression::quotedValue( attributes.at( referencingIdx ) ) );
conditions << QgsExpression::createFieldEqualityExpression( fieldPair.referencedField(), attributes.at( referencingIdx ) );
}

QgsFeatureRequest myRequest;
Expand Down

0 comments on commit 29c4fcf

Please sign in to comment.