Skip to content

Commit

Permalink
Include main annotation layer when exporting canvas to image/pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 1, 2020
1 parent 20fd8e8 commit 97b56fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/qgsmapsavedialog.cpp
Expand Up @@ -45,6 +45,7 @@
#include "qgsapplication.h"
#include "qgsexpressioncontextutils.h"
#include "qgsfileutils.h"
#include "qgsannotationlayer.h"

Q_GUI_EXPORT extern int qt_defaultDpiX();

Expand Down Expand Up @@ -334,7 +335,13 @@ void QgsMapSaveDialog::applyMapSettings( QgsMapSettings &mapSettings )
mapSettings.setBackgroundColor( mMapCanvas->canvasColor() );
mapSettings.setRotation( mMapCanvas->rotation() );
mapSettings.setEllipsoid( QgsProject::instance()->ellipsoid() );
mapSettings.setLayers( mMapCanvas->layers() );

QList< QgsMapLayer * > layers = mMapCanvas->layers();
if ( !QgsProject::instance()->mainAnnotationLayer()->isEmpty() )
{
layers.insert( 0, QgsProject::instance()->mainAnnotationLayer() );
}
mapSettings.setLayers( layers );
mapSettings.setLabelingEngineSettings( mMapCanvas->mapSettings().labelingEngineSettings() );
mapSettings.setTransformContext( QgsProject::instance()->transformContext() );
mapSettings.setPathResolver( QgsProject::instance()->pathResolver() );
Expand Down

0 comments on commit 97b56fe

Please sign in to comment.