Skip to content
Permalink
Browse files

Ensure all canvases show annotations

  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent f81b63b commit d452ae12f7510c06cf70abb81329655506a6bb5d
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/app/qgisapp.cpp
@@ -1488,8 +1488,11 @@ void QgisApp::dropEventTimeout()
void QgisApp::annotationCreated( QgsAnnotation *annotation )
{
// create canvas annotation item for annotation
QgsMapCanvasAnnotationItem *canvasItem = new QgsMapCanvasAnnotationItem( annotation, mMapCanvas );
Q_UNUSED( canvasItem ); //item is already added automatically to canvas scene
Q_FOREACH ( QgsMapCanvas *canvas, mapCanvases() )
{
QgsMapCanvasAnnotationItem *canvasItem = new QgsMapCanvasAnnotationItem( annotation, canvas );
Q_UNUSED( canvasItem ); //item is already added automatically to canvas scene
}
}

void QgisApp::registerCustomDropHandler( QgsCustomDropHandler *handler )
@@ -3121,6 +3124,13 @@ QgsMapCanvas *QgisApp::createNewMapCanvas( const QString &name )
mapCanvas->freeze( true );
mapCanvas->setObjectName( name );

// add existing annotations to canvas
Q_FOREACH ( QgsAnnotation *annotation, QgsProject::instance()->annotationManager()->annotations() )
{
QgsMapCanvasAnnotationItem *canvasItem = new QgsMapCanvasAnnotationItem( annotation, mapCanvas );
Q_UNUSED( canvasItem ); //item is already added automatically to canvas scene
}

applyProjectSettingsToCanvas( mapCanvas );

mapCanvas->setDestinationCrs( QgsProject::instance()->crs() );

0 comments on commit d452ae1

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