Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 cb23e3a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/layertree/qgslayertreeutils.cpp
Expand Up @@ -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() )
{
Expand Down

0 comments on commit cb23e3a

Please sign in to comment.