Skip to content
Permalink
Browse files

Include main annotation layer when exporting canvas to image/pdf

  • Loading branch information
nyalldawson committed Sep 1, 2020
1 parent 20fd8e8 commit 97b56fef2eee4a5a619b347ba7f1660f7b2b680b
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/app/qgsmapsavedialog.cpp
@@ -45,6 +45,7 @@
#include "qgsapplication.h"
#include "qgsexpressioncontextutils.h"
#include "qgsfileutils.h"
#include "qgsannotationlayer.h"

Q_GUI_EXPORT extern int qt_defaultDpiX();

@@ -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() );

0 comments on commit 97b56fe

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