Skip to content

Commit f9f683d

Browse files
committed
Fix new annotations are shown even when annotations are hidden
Fixes #19117
1 parent 7466544 commit f9f683d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/gui/qgsmapcanvasannotationitem.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,20 @@ void QgsMapCanvasAnnotationItem::updateBoundingRect()
120120

121121
void QgsMapCanvasAnnotationItem::onCanvasLayersChanged()
122122
{
123-
if ( !mAnnotation->mapLayer() )
123+
if ( !mMapCanvas->annotationsVisible() )
124124
{
125-
setVisible( true );
125+
setVisible( false );
126126
}
127127
else
128128
{
129-
setVisible( mMapCanvas->mapSettings().layers().contains( mAnnotation->mapLayer() ) );
129+
if ( !mAnnotation->mapLayer() )
130+
{
131+
setVisible( true );
132+
}
133+
else
134+
{
135+
setVisible( mMapCanvas->mapSettings().layers().contains( mAnnotation->mapLayer() ) );
136+
}
130137
}
131138
}
132139

0 commit comments

Comments
 (0)