Skip to content
Permalink
Browse files

Fix FilterExpression feature requests will ignore expression if

using virtual fields or other complex filters

refs #13695

(cherry-picked from dddd043)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 5d359a6 commit 3c11a5d7d6f1d767dd2ae7d357681c3a26a16a21
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 3c11a5d

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