Skip to content
Permalink
Browse files

bugfix: replace all childNodes, not just the first half

followup to 1a1af37
  • Loading branch information
SebDieBln committed Jan 16, 2016
1 parent 0ca359e commit 6971bd855fbc353db8e20e608e6d660043f38830
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/core/qgslayerdefinition.cpp
@@ -66,16 +66,11 @@ bool QgsLayerDefinition::loadLayerDefinition( QDomDocument doc, QgsLayerTreeGrou
clonedSorted << node.cloneNode();
}
QDomNode layersNode = doc.elementsByTagName( "maplayers" ).at( 0 );
// remove old children
// replace old children with new ones
QDomNodeList childNodes = layersNode.childNodes();
for ( int i = 0; i < childNodes.size(); i++ )
{
layersNode.removeChild( childNodes.at( i ) );
}
// replace with new ones
foreach ( QDomNode node, clonedSorted )
{
layersNode.appendChild( node );
layersNode.replaceChild( clonedSorted.at( i ), childNodes.at( i ) );
}
}
// if a dependency is missing, we still try to load layers, since dependencies may already be loaded

0 comments on commit 6971bd8

Please sign in to comment.
You can’t perform that action at this time.