Skip to content

Commit

Permalink
fix: don't keep reference of styling history on annotation layer reset
Browse files Browse the repository at this point in the history
the layer styling panel always showed history of the main annotation layer of a previously opened project
  • Loading branch information
CodeBardian authored and nyalldawson committed Jan 10, 2023
1 parent 3500e06 commit d91acd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/annotations/qgsannotationlayer.cpp
Expand Up @@ -131,6 +131,9 @@ void QgsAnnotationLayer::reset()
setOpacity( 1.0 );
setCrs( QgsCoordinateReferenceSystem() );
setTransformContext( QgsCoordinateTransformContext() );

undoStackStyles()->clear();

clear();
}

Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_qgsannotationlayer.py
Expand Up @@ -152,6 +152,7 @@ def testReset(self):
self.assertEqual(len(layer.items()), 0)
self.assertEqual(layer.opacity(), 1.0)
self.assertFalse(layer.crs().isValid())
self.assertEqual(layer.undoStackStyles().count(), 0)

def testExtent(self):
layer = QgsAnnotationLayer('test', QgsAnnotationLayer.LayerOptions(QgsProject.instance().transformContext()))
Expand Down

0 comments on commit d91acd6

Please sign in to comment.