Skip to content
Permalink
Browse files

[save as image] attach scope variables

This is needed to properly render symbols with
expression-based styling rely on those.
  • Loading branch information
nirvn committed Jun 2, 2017
1 parent fb11f1d commit b365e5e6519c6e6b3c47ee8ddb19cc7c3c1b8e18
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/app/qgsmapsavedialog.cpp
@@ -20,9 +20,11 @@
#include "qgis.h"
#include "qgsscalecalculator.h"
#include "qgsdecorationitem.h"
#include "qgsexpressioncontext.h"
#include "qgsextentgroupbox.h"
#include "qgsmapsettings.h"
#include "qgsmapsettingsutils.h"
#include "qgsproject.h"
#include "qgssettings.h"

#include <QCheckBox>
@@ -211,4 +213,12 @@ void QgsMapSaveDialog::applyMapSettings( QgsMapSettings &mapSettings )
mapSettings.setBackgroundColor( mMapCanvas->canvasColor() );
mapSettings.setRotation( mMapCanvas->rotation() );
mapSettings.setLayers( mMapCanvas->layers() );

//build the expression context
QgsExpressionContext expressionContext;
expressionContext << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::mapSettingsScope( mapSettings );

mapSettings.setExpressionContext( expressionContext );
}

0 comments on commit b365e5e

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