Skip to content

Commit

Permalink
Fix rule based renderer shows 0 count on first click of "show counts"
Browse files Browse the repository at this point in the history
(cherry-picked from 291f7bd)
  • Loading branch information
nyalldawson committed Oct 6, 2016
1 parent 31dc608 commit 5c339e7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 );

Expand Down

0 comments on commit 5c339e7

Please sign in to comment.