Skip to content

Commit

Permalink
[layertree] Preserve the order of layers when adding several layers a…
Browse files Browse the repository at this point in the history
…t once
  • Loading branch information
wonder-sk committed Jun 3, 2014
1 parent 974a3eb commit be7c4d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/layertree/qgslayertreeregistrybridge.cpp
Expand Up @@ -47,10 +47,11 @@ void QgsLayerTreeRegistryBridge::layersAdded( QList<QgsMapLayer*> layers )
if ( !mEnabled )
return;

int i = 0;
foreach ( QgsMapLayer* layer, layers )
{
// add new layer to the top
QgsLayerTreeLayer* nodeLayer = mInsertionPointGroup->insertLayer( mInsertionPointIndex, layer );
QgsLayerTreeLayer* nodeLayer = mInsertionPointGroup->insertLayer( mInsertionPointIndex + i++, layer );

// check whether the layer is marked as embedded
QString projectFile = QgsProject::instance()->layerIsEmbedded( nodeLayer->layerId() );
Expand Down

0 comments on commit be7c4d0

Please sign in to comment.