Skip to content

Commit 219a45a

Browse files
committed
Ensure newly added annotations are selected
1 parent 4040565 commit 219a45a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/app/qgsmaptoolannotation.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent* e )
128128
annotation->setFrameSize( QSizeF( 200, 100 ) );
129129

130130
QgsProject::instance()->annotationManager()->addAnnotation( annotation );
131+
132+
// select newly added item
133+
Q_FOREACH ( QGraphicsItem* item , mCanvas->items() )
134+
{
135+
if ( QgsMapCanvasAnnotationItem* annotationItem = dynamic_cast< QgsMapCanvasAnnotationItem* >( item ) )
136+
{
137+
if ( annotationItem->annotation() == annotation )
138+
{
139+
annotationItem->setSelected( true );
140+
break;
141+
}
142+
}
143+
}
131144
}
132145
}
133146
}

0 commit comments

Comments
 (0)