Skip to content

Commit 5d1d25b

Browse files
committedJan 5, 2018
Add atlas expression context scope to layouts
1 parent 3318bfb commit 5d1d25b

26 files changed

+110
-42
lines changed
 

‎python/core/layout/qgslayoutatlas.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Constructor for new QgsLayoutAtlas.
3838

3939
virtual QgsLayout *layout();
4040

41+
42+
4143
virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
4244

4345
virtual bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );

‎python/core/layout/qgsprintlayout.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Returns the print layout's atlas.
3535

3636
virtual bool readXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context );
3737

38+
virtual QgsExpressionContext createExpressionContext() const;
39+
3840

3941
};
4042

‎python/core/qgsexpressioncontext.sip

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,11 +1045,19 @@ with the variables specified.
10451045
.. versionadded:: 3.0
10461046
%End
10471047

1048-
static QgsExpressionContextScope *atlasScope( const QgsAtlasComposition *atlas ) /Factory/;
1048+
static QgsExpressionContextScope *compositionAtlasScope( const QgsAtlasComposition *atlas ) /Factory/;
10491049
%Docstring
10501050
Creates a new scope which contains variables and functions relating to a :py:class:`QgsAtlasComposition`.
10511051
For instance, current page name and number.
10521052

1053+
:param atlas: source atlas. If null, a set of default atlas variables will be added to the scope.
1054+
%End
1055+
1056+
static QgsExpressionContextScope *atlasScope( const QgsLayoutAtlas *atlas ) /Factory/;
1057+
%Docstring
1058+
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
1059+
For instance, current page name and number.
1060+
10531061
:param atlas: source atlas. If null, a set of default atlas variables will be added to the scope.
10541062
%End
10551063

‎src/app/qgsdiagramproperties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ QgsExpressionContext QgsDiagramProperties::createExpressionContext() const
5252
QgsExpressionContext expContext;
5353
expContext << QgsExpressionContextUtils::globalScope()
5454
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
55-
<< QgsExpressionContextUtils::atlasScope( nullptr )
55+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
5656
<< QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
5757
<< QgsExpressionContextUtils::layerScope( mLayer );
5858

@@ -931,7 +931,7 @@ QString QgsDiagramProperties::showExpressionBuilder( const QString &initialExpre
931931
QgsExpressionContext context;
932932
context << QgsExpressionContextUtils::globalScope()
933933
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
934-
<< QgsExpressionContextUtils::atlasScope( nullptr )
934+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
935935
<< QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )
936936
<< QgsExpressionContextUtils::layerScope( mLayer );
937937

‎src/app/qgslabelinggui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ QgsExpressionContext QgsLabelingGui::createExpressionContext() const
2929
QgsExpressionContext expContext;
3030
expContext << QgsExpressionContextUtils::globalScope()
3131
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
32-
<< QgsExpressionContextUtils::atlasScope( nullptr )
32+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
3333
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() );
3434

3535
if ( mLayer )

‎src/app/qgslabelpropertydialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void QgsLabelPropertyDialog::setDataDefinedValues( QgsVectorLayer *vlayer )
255255
QgsExpressionContext context;
256256
context << QgsExpressionContextUtils::globalScope()
257257
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
258-
<< QgsExpressionContextUtils::atlasScope( nullptr )
258+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
259259
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() )
260260
<< QgsExpressionContextUtils::layerScope( vlayer );
261261
context.setFeature( mCurLabelFeat );

‎src/app/qgspointmarkeritem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ QgsRenderContext QgsPointMarkerItem::renderContext( QPainter *painter )
3333
QgsExpressionContext context;
3434
context << QgsExpressionContextUtils::globalScope()
3535
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
36-
<< QgsExpressionContextUtils::atlasScope( nullptr );
36+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
3737
if ( mMapCanvas )
3838
{
3939
context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )

‎src/app/qgsrulebasedlabelingwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static QList<QgsExpressionContextScope *> _globalProjectAtlasMapLayerScopes( Qgs
3535
QList<QgsExpressionContextScope *> scopes;
3636
scopes << QgsExpressionContextUtils::globalScope()
3737
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
38-
<< QgsExpressionContextUtils::atlasScope( nullptr );
38+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
3939
if ( mapCanvas )
4040
{
4141
scopes << QgsExpressionContextUtils::mapSettingsScope( mapCanvas->mapSettings() )

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
130130

131131
mContext << QgsExpressionContextUtils::globalScope()
132132
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
133-
<< QgsExpressionContextUtils::atlasScope( nullptr )
133+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
134134
<< QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() )
135135
<< QgsExpressionContextUtils::layerScope( mLayer );
136136

‎src/core/composer/qgsatlascomposition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ QgsExpressionContext QgsAtlasComposition::createExpressionContext()
723723
expressionContext << QgsExpressionContextUtils::projectScope( mComposition->project() )
724724
<< QgsExpressionContextUtils::compositionScope( mComposition );
725725

726-
expressionContext.appendScope( QgsExpressionContextUtils::atlasScope( this ) );
726+
expressionContext.appendScope( QgsExpressionContextUtils::compositionAtlasScope( this ) );
727727
if ( mCoverageLayer )
728728
expressionContext.lastScope()->setFields( mCoverageLayer->fields() );
729729
if ( mComposition && mComposition->atlasMode() != QgsComposition::AtlasOff )

‎src/core/composer/qgscomposition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3284,7 +3284,7 @@ QgsExpressionContext QgsComposition::createExpressionContext() const
32843284
context.appendScope( QgsExpressionContextUtils::compositionScope( this ) );
32853285
if ( mAtlasComposition.enabled() )
32863286
{
3287-
context.appendScope( QgsExpressionContextUtils::atlasScope( &mAtlasComposition ) );
3287+
context.appendScope( QgsExpressionContextUtils::compositionAtlasScope( &mAtlasComposition ) );
32883288
}
32893289
return context;
32903290
}

‎src/core/layout/qgslayout.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,6 @@ QgsExpressionContext QgsLayout::createExpressionContext() const
325325
context.appendScope( QgsExpressionContextUtils::globalScope() );
326326
context.appendScope( QgsExpressionContextUtils::projectScope( mProject ) );
327327
context.appendScope( QgsExpressionContextUtils::layoutScope( this ) );
328-
#if 0 //TODO
329-
if ( mAtlasComposition.enabled() )
330-
{
331-
context.appendScope( QgsExpressionContextUtils::atlasScope( &mAtlasComposition ) );
332-
}
333-
#endif
334328
return context;
335329
}
336330

‎src/core/layout/qgslayoutatlas.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ QgsLayout *QgsLayoutAtlas::layout()
4242
return mLayout;
4343
}
4444

45+
const QgsLayout *QgsLayoutAtlas::layout() const
46+
{
47+
return mLayout.data();
48+
}
49+
4550
bool QgsLayoutAtlas::writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext & ) const
4651
{
4752
QDomElement atlasElem = document.createElement( QStringLiteral( "Atlas" ) );

‎src/core/layout/qgslayoutatlas.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class CORE_EXPORT QgsLayoutAtlas : public QObject, public QgsAbstractLayoutItera
4646

4747
QString stringType() const override;
4848
QgsLayout *layout() override;
49+
50+
/**
51+
* Returns the atlas' layout.
52+
* \note Not available in Python bindings.
53+
*/
54+
const QgsLayout *layout() const SIP_SKIP;
55+
4956
bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const override;
5057
bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ) override;
5158

‎src/core/layout/qgslayoutitemlabel.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "qgsfontutils.h"
3030
#include "qgsexpressioncontext.h"
3131
#include "qgsmapsettings.h"
32-
#include "qgscomposermap.h"
32+
#include "qgslayoutitemmap.h"
3333
#include "qgssettings.h"
3434

3535
#include "qgswebview.h"
@@ -69,11 +69,9 @@ QgsLayoutItemLabel::QgsLayoutItemLabel( QgsLayout *layout )
6969

7070
if ( mLayout )
7171
{
72-
#if 0 //TODO
73-
//connect to atlas feature changes
72+
//connect to context feature changes
7473
//to update the expression context
75-
connect( &mLayout->atlasComposition(), &QgsAtlasComposition::featureChanged, this, &QgsLayoutItemLabel::refreshExpressionContext );
76-
#endif
74+
connect( &mLayout->context(), &QgsLayoutContext::changed, this, &QgsLayoutItemLabel::refreshExpressionContext );
7775
}
7876

7977
mWebPage.reset( new QgsWebPage( this ) );
@@ -244,27 +242,18 @@ void QgsLayoutItemLabel::refreshExpressionContext()
244242
if ( !mLayout )
245243
return;
246244

247-
QgsVectorLayer *layer = nullptr;
248-
#if 0 //TODO
249-
if ( mComposition->atlasComposition().enabled() )
250-
{
251-
layer = mComposition->atlasComposition().coverageLayer();
252-
}
253-
#endif
254-
245+
QgsVectorLayer *layer = mLayout->context().layer();
255246
//setup distance area conversion
256247
if ( layer )
257248
{
258249
mDistanceArea->setSourceCrs( layer->crs(), mLayout->project()->transformContext() );
259250
}
260251
else
261252
{
262-
#if 0 //TODO
263253
//set to composition's reference map's crs
264-
QgsLayoutItemMap *referenceMap = mComposition->referenceMap();
254+
QgsLayoutItemMap *referenceMap = mLayout->referenceMap();
265255
if ( referenceMap )
266256
mDistanceArea->setSourceCrs( referenceMap->crs() );
267-
#endif
268257
}
269258
mDistanceArea->setEllipsoid( mLayout->project()->ellipsoid() );
270259
contentChanged();

‎src/core/layout/qgsprintlayout.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,15 @@ bool QgsPrintLayout::readXml( const QDomElement &layoutElement, const QDomDocume
4444
mAtlas->readXml( atlasElem, document, context );
4545
return true;
4646
}
47+
48+
QgsExpressionContext QgsPrintLayout::createExpressionContext() const
49+
{
50+
QgsExpressionContext context = QgsLayout::createExpressionContext();
51+
52+
if ( mAtlas->enabled() )
53+
{
54+
context.appendScope( QgsExpressionContextUtils::atlasScope( mAtlas ) );
55+
}
56+
57+
return context;
58+
}

‎src/core/layout/qgsprintlayout.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class CORE_EXPORT QgsPrintLayout : public QgsLayout
4545

4646
QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const override;
4747
bool readXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) override;
48+
QgsExpressionContext createExpressionContext() const override;
4849

4950
private:
5051

‎src/core/qgsexpressioncontext.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "qgsmaplayerlistutils.h"
3232
#include "qgsprocessingcontext.h"
3333
#include "qgsprocessingalgorithm.h"
34+
#include "qgslayoutatlas.h"
3435
#include "qgslayout.h"
3536

3637
#include <QSettings>
@@ -1127,7 +1128,7 @@ void QgsExpressionContextUtils::setLayoutVariables( QgsLayout *layout, const QVa
11271128
layout->setCustomProperty( QStringLiteral( "variableValues" ), variableValues );
11281129
}
11291130

1130-
QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( const QgsAtlasComposition *atlas )
1131+
QgsExpressionContextScope *QgsExpressionContextUtils::compositionAtlasScope( const QgsAtlasComposition *atlas )
11311132
{
11321133
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Atlas" ) );
11331134
if ( !atlas )
@@ -1166,6 +1167,45 @@ QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( const QgsAtlas
11661167
return scope;
11671168
}
11681169

1170+
QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( const QgsLayoutAtlas *atlas )
1171+
{
1172+
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Atlas" ) );
1173+
if ( !atlas )
1174+
{
1175+
//add some dummy atlas variables. This is done so that as in certain contexts we want to show
1176+
//users that these variables are available even if they have no current value
1177+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_pagename" ), QString(), true ) );
1178+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_feature" ), QVariant::fromValue( QgsFeature() ), true ) );
1179+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featureid" ), 0, true ) );
1180+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_geometry" ), QVariant::fromValue( QgsGeometry() ), true ) );
1181+
return scope;
1182+
}
1183+
1184+
//add known atlas variables
1185+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_totalfeatures" ), atlas->count(), true ) );
1186+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featurenumber" ), atlas->currentFeatureNumber() + 1, true ) );
1187+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_filename" ), atlas->currentFilename(), true ) );
1188+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_pagename" ), atlas->nameForPage( atlas->currentFeatureNumber() ), true ) );
1189+
1190+
if ( atlas->enabled() && atlas->coverageLayer() )
1191+
{
1192+
scope->setFields( atlas->coverageLayer()->fields() );
1193+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_layerid" ), atlas->coverageLayer()->id(), true ) );
1194+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_layername" ), atlas->coverageLayer()->name(), true ) );
1195+
}
1196+
1197+
if ( atlas->enabled() )
1198+
{
1199+
QgsFeature atlasFeature = atlas->layout()->context().feature();
1200+
scope->setFeature( atlasFeature );
1201+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_feature" ), QVariant::fromValue( atlasFeature ), true ) );
1202+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featureid" ), atlasFeature.id(), true ) );
1203+
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_geometry" ), QVariant::fromValue( atlasFeature.geometry() ), true ) );
1204+
}
1205+
1206+
return scope;
1207+
}
1208+
11691209
QgsExpressionContextScope *QgsExpressionContextUtils::composerItemScope( const QgsComposerItem *composerItem )
11701210
{
11711211
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Composer Item" ) );

‎src/core/qgsexpressioncontext.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class QgsProject;
4040
class QgsSymbol;
4141
class QgsProcessingAlgorithm;
4242
class QgsProcessingContext;
43+
class QgsLayoutAtlas;
4344

4445
/**
4546
* \ingroup core
@@ -926,7 +927,14 @@ class CORE_EXPORT QgsExpressionContextUtils
926927
* For instance, current page name and number.
927928
* \param atlas source atlas. If null, a set of default atlas variables will be added to the scope.
928929
*/
929-
static QgsExpressionContextScope *atlasScope( const QgsAtlasComposition *atlas ) SIP_FACTORY;
930+
static QgsExpressionContextScope *compositionAtlasScope( const QgsAtlasComposition *atlas ) SIP_FACTORY;
931+
932+
/**
933+
* Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
934+
* For instance, current page name and number.
935+
* \param atlas source atlas. If null, a set of default atlas variables will be added to the scope.
936+
*/
937+
static QgsExpressionContextScope *atlasScope( const QgsLayoutAtlas *atlas ) SIP_FACTORY;
930938

931939
/**
932940
* Creates a new scope which contains variables and functions relating to a QgsComposerItem.

‎src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ void QgsCategorizedSymbolRendererWidget::addCategories()
635635
QgsExpressionContext context;
636636
context << QgsExpressionContextUtils::globalScope()
637637
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
638-
<< QgsExpressionContextUtils::atlasScope( nullptr )
638+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr )
639639
<< QgsExpressionContextUtils::layerScope( mLayer );
640640

641641
expression->prepare( &context );
@@ -1014,7 +1014,7 @@ QgsExpressionContext QgsCategorizedSymbolRendererWidget::createExpressionContext
10141014
QgsExpressionContext expContext;
10151015
expContext << QgsExpressionContextUtils::globalScope()
10161016
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
1017-
<< QgsExpressionContextUtils::atlasScope( nullptr );
1017+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
10181018

10191019
if ( mContext.mapCanvas() )
10201020
{

‎src/gui/symbology/qgsdatadefinedsizelegendwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void QgsDataDefinedSizeLegendWidget::changeSymbol()
178178
QgsExpressionContext ec;
179179
ec << QgsExpressionContextUtils::globalScope()
180180
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
181-
<< QgsExpressionContextUtils::atlasScope( nullptr );
181+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
182182
if ( mMapCanvas )
183183
ec << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() );
184184
context.setExpressionContext( &ec );

‎src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ QgsExpressionContext QgsGraduatedSymbolRendererWidget::createExpressionContext()
396396
QgsExpressionContext expContext;
397397
expContext << QgsExpressionContextUtils::globalScope()
398398
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
399-
<< QgsExpressionContextUtils::atlasScope( nullptr );
399+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
400400

401401
if ( mContext.mapCanvas() )
402402
{

‎src/gui/symbology/qgsheatmaprendererwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ QgsExpressionContext QgsHeatmapRendererWidget::createExpressionContext() const
3838
QgsExpressionContext expContext;
3939
expContext << QgsExpressionContextUtils::globalScope()
4040
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
41-
<< QgsExpressionContextUtils::atlasScope( nullptr );
41+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
4242

4343
if ( mContext.mapCanvas() )
4444
{

‎src/gui/symbology/qgslayerpropertieswidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ QgsExpressionContext QgsLayerPropertiesWidget::createExpressionContext() const
217217
QgsExpressionContext expContext;
218218
expContext << QgsExpressionContextUtils::globalScope()
219219
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
220-
<< QgsExpressionContextUtils::atlasScope( nullptr );
220+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
221221

222222
if ( mContext.mapCanvas() )
223223
{

‎src/gui/symbology/qgsrendererwidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ QgsExpressionContext QgsDataDefinedValueDialog::createExpressionContext() const
327327
QgsExpressionContext expContext;
328328
expContext << QgsExpressionContextUtils::globalScope()
329329
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
330-
<< QgsExpressionContextUtils::atlasScope( nullptr );
330+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
331331
if ( mContext.mapCanvas() )
332332
{
333333
expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() )

‎src/gui/symbology/qgssymbolwidgetcontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ QList<QgsExpressionContextScope *> QgsSymbolWidgetContext::globalProjectAtlasMap
7979
QList<QgsExpressionContextScope *> scopes;
8080
scopes << QgsExpressionContextUtils::globalScope()
8181
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
82-
<< QgsExpressionContextUtils::atlasScope( nullptr );
82+
<< QgsExpressionContextUtils::compositionAtlasScope( nullptr );
8383
if ( mMapCanvas )
8484
{
8585
scopes << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() )

0 commit comments

Comments
 (0)
Please sign in to comment.