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
  • Loading branch information
nyalldawson committed Oct 3, 2016
1 parent 0a9491a commit 291f7bd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ void QgsRuleBasedRendererWidget::countFeatures()
countMap[rule].duplicateCount = 0;
}

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

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

Expand All @@ -543,10 +541,11 @@ void QgsRuleBasedRendererWidget::countFeatures()
}

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 291f7bd

Please sign in to comment.