Skip to content

Commit b365e5e

Browse files
authoredJun 2, 2017
[save as image] attach scope variables
This is needed to properly render symbols with expression-based styling rely on those.
1 parent fb11f1d commit b365e5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/app/qgsmapsavedialog.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
#include "qgis.h"
2121
#include "qgsscalecalculator.h"
2222
#include "qgsdecorationitem.h"
23+
#include "qgsexpressioncontext.h"
2324
#include "qgsextentgroupbox.h"
2425
#include "qgsmapsettings.h"
2526
#include "qgsmapsettingsutils.h"
27+
#include "qgsproject.h"
2628
#include "qgssettings.h"
2729

2830
#include <QCheckBox>
@@ -211,4 +213,12 @@ void QgsMapSaveDialog::applyMapSettings( QgsMapSettings &mapSettings )
211213
mapSettings.setBackgroundColor( mMapCanvas->canvasColor() );
212214
mapSettings.setRotation( mMapCanvas->rotation() );
213215
mapSettings.setLayers( mMapCanvas->layers() );
216+
217+
//build the expression context
218+
QgsExpressionContext expressionContext;
219+
expressionContext << QgsExpressionContextUtils::globalScope()
220+
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
221+
<< QgsExpressionContextUtils::mapSettingsScope( mapSettings );
222+
223+
mapSettings.setExpressionContext( expressionContext );
214224
}

0 commit comments

Comments
 (0)
Please sign in to comment.