Skip to content
Permalink
Browse files
Don't store original layer xml for annotation layers -- these layers
can never be broken, so it's a waste of time to store the
unused original xml
  • Loading branch information
nyalldawson committed Aug 19, 2021
1 parent 9cfdf3d commit cb23e3a03c0551f49856e63f6d16f91d415e97fe
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/core/layertree/qgslayertreeutils.cpp
@@ -313,16 +313,18 @@ void QgsLayerTreeUtils::removeInvalidLayers( QgsLayerTreeGroup *group )

void QgsLayerTreeUtils::storeOriginalLayersProperties( QgsLayerTreeGroup *group, const QDomDocument *doc )
{

const QDomElement projectLayersElement { doc->documentElement().firstChildElement( QStringLiteral( "projectlayers" ) ) };

std::function<void ( QgsLayerTreeNode * )> _store = [ & ]( QgsLayerTreeNode * node )
{
if ( QgsLayerTree::isLayer( node ) )
{
QgsMapLayer *l( QgsLayerTree::toLayer( node )->layer() );
if ( l )
if ( QgsMapLayer *l = QgsLayerTree::toLayer( node )->layer() )
{
// no need to store for annotation layers, they can never break!
if ( l->type() == QgsMapLayerType::AnnotationLayer )
return;

QDomElement layerElement { projectLayersElement.firstChildElement( QStringLiteral( "maplayer" ) ) };
while ( ! layerElement.isNull() )
{

0 comments on commit cb23e3a

Please sign in to comment.