Skip to content

Commit

Permalink
Use the full available expression context when rendering symbols
Browse files Browse the repository at this point in the history
in layout legends

This means the symbols will have access to variables like the
current atlas feature.
  • Loading branch information
nyalldawson committed Jan 18, 2019
1 parent fccb808 commit 2df5893
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/core/layertree/qgslayertreemodellegendnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,17 @@ QSizeF QgsSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemC
context.setForceVectorOutput( true );
context.setPainter( ctx ? ctx->painter : nullptr );

// use a minimal expression context for now
QgsExpressionContext expContext;
expContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( nullptr ) );
context.setExpressionContext( expContext );
if ( ctx && ctx->context )
{
context.setExpressionContext( ctx->context->expressionContext() );
}
else
{
// setup a minimal expression context
QgsExpressionContext expContext;
expContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( nullptr ) );
context.setExpressionContext( expContext );
}

//Consider symbol size for point markers
double height = settings.symbolSize().height();
Expand Down

0 comments on commit 2df5893

Please sign in to comment.