Skip to content
Permalink
Browse files

fix reordering of render order (followup 78c60a2)

  • Loading branch information
jef-n committed Jul 2, 2015
1 parent 5f23329 commit df4a41f7800083db5be4bb9ba152209f1e57f575
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/gui/layertree/qgslayertreemapcanvasbridge.cpp
@@ -82,25 +82,31 @@ void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder( const QStringList& order
return;

// verify that the new order is correct
QStringList defOrder = defaultLayerOrder();
QStringList sortedNewOrder = order;
QStringList defOrder( defaultLayerOrder() );
QStringList newOrder( order );
QStringList sortedNewOrder( order );
qSort( defOrder );
qSort( sortedNewOrder );

if ( defOrder.size() < sortedNewOrder.size() )
{
// some bad layers in the list?
// might contain bad layers, but also duplicates
QSet<QString> ids( defOrder.toSet() );

for ( int i = 0; i < sortedNewOrder.size(); i++ )
{
if ( i >= defOrder.size() || defOrder[i] != sortedNewOrder[i] )
if ( !ids.contains( sortedNewOrder[i] ) )
{
newOrder.removeAll( sortedNewOrder[i] );
sortedNewOrder.removeAt( i-- );
}
}
}

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

mCustomLayerOrder = order;
mCustomLayerOrder = newOrder;
emit customLayerOrderChanged( mCustomLayerOrder );

if ( mHasCustomLayerOrder )

0 comments on commit df4a41f

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