Don't emit layerOrderChanged when removing layers

Otherwise it automatically enables the layer order panel
This commit is contained in:
Nyall Dawson 2017-03-22 13:01:32 +10:00
parent b8fd1fd7db
commit 746d288e33
2 changed files with 1 additions and 5 deletions

View File

@ -2171,7 +2171,6 @@ void QgsProject::removeMapLayers( const QList<QgsMapLayer *> &layers )
QStringList layerIds;
QList<QgsMapLayer *> layerList;
bool layerOrderHasChanged = false;
QList< QgsMapLayer * > currentOrder = layerOrder();
Q_FOREACH ( QgsMapLayer *layer, layers )
{
@ -2180,7 +2179,6 @@ void QgsProject::removeMapLayers( const QList<QgsMapLayer *> &layers )
{
layerIds << layer->id();
layerList << layer;
layerOrderHasChanged = layerOrderHasChanged || currentOrder.contains( layer );
}
}
@ -2204,8 +2202,6 @@ void QgsProject::removeMapLayers( const QList<QgsMapLayer *> &layers )
}
emit layersRemoved( layerIds );
if ( layerOrderHasChanged )
emit layerOrderChanged();
}
void QgsProject::removeMapLayer( const QString &layerId )

View File

@ -210,7 +210,7 @@ class TestQgsProject(unittest.TestCase):
self.assertEqual(len(layer_order_changed_spy), 3)
prj.removeMapLayer(layer)
self.assertEqual(prj.layerOrder(), [layer2, layer3])
self.assertEqual(len(layer_order_changed_spy), 4)
self.assertEqual(len(layer_order_changed_spy), 3) # should be no signal
# save and restore
file_name = os.path.join(str(QDir.tempPath()), 'proj.qgs')