Skip to content
Permalink
Browse files

handle bad layers when custom layer order is set (fixes #12733)

  • Loading branch information
jef-n committed Jun 11, 2015
1 parent 8d0c281 commit 78c60a297c64f87b2c7fd15801a3c62d8af92cb0
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/gui/layertree/qgslayertreemapcanvasbridge.cpp
@@ -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

1 comment on commit 78c60a2

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson commented on 78c60a2 Jul 2, 2015

@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.
You can’t perform that action at this time.