Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
handle bad layers when custom layer order is set (fixes #12733)
  • Loading branch information
jef-n committed Jun 11, 2015
1 parent 8d0c281 commit 78c60a2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/layertree/qgslayertreemapcanvasbridge.cpp
Expand Up @@ -86,6 +86,17 @@ void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder( const QStringList& order
QStringList sortedNewOrder = order;
qSort( defOrder );
qSort( sortedNewOrder );

if ( defOrder.size() < sortedNewOrder.size() )
{
// some bad layers in the list?
for ( int i = 0; i < sortedNewOrder.size(); i++ )
{
if ( i >= defOrder.size() || defOrder[i] != sortedNewOrder[i] )
sortedNewOrder.removeAt( i-- );
}
}

if ( defOrder != sortedNewOrder )
return; // must be permutation of the default order

Expand Down

1 comment on commit 78c60a2

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n this fix has broken drag and drop of layers within the layer order panel - see http://gis.stackexchange.com/questions/153009/layer-order-panel-seems-to-be-broken-in-qgis-2-10-it-duplicates-layers

Please sign in to comment.