Skip to content

Commit

Permalink
[save as image] attach scope variables
Browse files Browse the repository at this point in the history
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 b365e5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsmapsavedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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.