Skip to content
Permalink
Browse files

Fix rule based renderer shows 0 count on first click of "show counts"

(cherry-picked from 291f7bd)
  • Loading branch information
nyalldawson committed Oct 6, 2016
1 parent 31dc608 commit 5c339e737a878650a2f28929f78085f055d69853
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
@@ -515,8 +515,6 @@ void QgsRuleBasedRendererV2Widget::countFeatures()
countMap[rule].duplicateCount = 0;
}

QgsFeatureRequest req = QgsFeatureRequest().setFilterExpression( mRenderer->filter( mLayer->fields() ) );

QgsRenderContext renderContext;
renderContext.setRendererScale( 0 ); // ignore scale

@@ -536,10 +534,11 @@ void QgsRuleBasedRendererV2Widget::countFeatures()
context << QgsExpressionContextUtils::layerScope( mLayer );

renderContext.setExpressionContext( context );
req.setExpressionContext( context );

mRenderer->startRender( renderContext, mLayer->fields() );

// QgsRuleBasedRenderer::filter must be called after startRender
QgsFeatureRequest req = QgsFeatureRequest().setFilterExpression( mRenderer->filter( mLayer->fields() ) );
req.setExpressionContext( context );
req.setSubsetOfAttributes( mRenderer->usedAttributes(), mLayer->fields() );
QgsFeatureIterator fit = mLayer->getFeatures( req );

0 comments on commit 5c339e7

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