Skip to content
Permalink
Browse files

Use the full available expression context when rendering symbols

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 2df58932e63339a4b0174a47c399663286d675ea
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/core/layertree/qgslayertreemodellegendnode.cpp
@@ -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();

0 comments on commit 2df5893

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