Skip to content

Commit

Permalink
bugfix: replace all childNodes, not just the first half
Browse files Browse the repository at this point in the history
followup to 1a1af37
  • Loading branch information
SebDieBln committed Jan 16, 2016
1 parent 0ca359e commit 6971bd8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/core/qgslayerdefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6971bd8

Please sign in to comment.