Skip to content

Commit

Permalink
Set the correct expression context for QgsHighlight
Browse files Browse the repository at this point in the history
Fixes #17896
  • Loading branch information
nyalldawson committed Feb 5, 2018
1 parent 325af48 commit 535de3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui/qgshighlight.cpp
Expand Up @@ -321,6 +321,8 @@ void QgsHighlight::paint( QPainter *p )
return;
QgsMapSettings mapSettings = mMapCanvas->mapSettings();
QgsRenderContext context = QgsRenderContext::fromMapSettings( mapSettings );
context.expressionContext() << QgsExpressionContextUtils::layerScope( mLayer );


// Because lower level outlines must be covered by upper level fill color
// we render first with temporary opaque color, which is then replaced
Expand All @@ -341,6 +343,7 @@ void QgsHighlight::paint( QPainter *p )
context.setPainter( &imagePainter );

renderer->startRender( context, layer->fields() );
context.expressionContext().setFeature( mFeature );
renderer->renderFeature( mFeature, context );
renderer->stopRender( context );

Expand Down

0 comments on commit 535de3b

Please sign in to comment.