Skip to content
Permalink
Browse files

Fix FilterExpression feature requests will ignore expression if

using virtual fields or other complex filters

refs #13695
  • Loading branch information
nyalldawson authored and m-kuhn committed Nov 2, 2015
1 parent 556d87a commit dddd043491deefe1e4c9606a87a771d22736ff05
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/core/qgsvectorlayerfeatureiterator.cpp
@@ -236,6 +236,17 @@ bool QgsVectorLayerFeatureIterator::fetchFeature( QgsFeature& f )
if ( mHasVirtualAttributes )
addVirtualAttributes( f );

if ( mRequest.filterType() == QgsFeatureRequest::FilterExpression && mProviderRequest.filterType() != QgsFeatureRequest::FilterExpression )
{
//filtering by expression, and couldn't do it on the provider side
mRequest.expressionContext()->setFeature( f );
if ( !mRequest.filterExpression()->evaluate( mRequest.expressionContext() ).toBool() )
{
//feature did not match filter
continue;
}
}

// update geometry
// TODO[MK]: FilterRect check after updating the geometry
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )

0 comments on commit dddd043

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