Skip to content

Commit 78ea81a

Browse files
committed
[composer] Set the expression context for labels created while atlas preview is enabled (fix #9457)
1 parent 3994c98 commit 78ea81a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/composer/qgscomposerlabel.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ):
4545
//default to a 10 point font size
4646
mFont.setPointSizeF( 10 );
4747

48+
if ( mComposition && mComposition->atlasMode() == QgsComposition::PreviewAtlas )
49+
{
50+
//a label added while atlas preview is enabled needs to have the expression context set,
51+
//otherwise fields in the label aren't correctly evaluated until atlas preview feature changes (#9457)
52+
setExpressionContext( mComposition->atlasComposition().currentFeature(), mComposition->atlasComposition().coverageLayer() );
53+
}
4854
}
4955

5056
QgsComposerLabel::~QgsComposerLabel()

0 commit comments

Comments
 (0)