Skip to content
Permalink
Browse files

Add full test suite for QgsMapLayerRegistry, also don't emit

any layer removed signals when no layers will actually be
removed
  • Loading branch information
nyalldawson committed Jul 4, 2016
1 parent 6b3cb24 commit 1a08f0ab533f058dbddbf4fbd0a66ea242840296
@@ -35,7 +35,7 @@ class QgsMapLayerRegistry : QObject
*/
QList<QgsMapLayer *> mapLayersByName( const QString& layerName ) const;

/** Returns a list of all registered layers.
/** Returns a map of all registered layers by layer ID.
* @see mapLayer()
* @see mapLayersByName()
* @see layers()
@@ -130,6 +130,9 @@ void QgsMapLayerRegistry::removeMapLayers( const QList<QgsMapLayer*>& layers )
layerIds << layer->id();
}

if ( layerIds.isEmpty() )
return;

emit layersWillBeRemoved( layerIds );
emit layersWillBeRemoved( layers );

@@ -62,14 +62,14 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
*/
QList<QgsMapLayer *> mapLayersByName( const QString& layerName ) const;

/** Returns a list of all registered layers.
/** Returns a map of all registered layers by layer ID.
* @see mapLayer()
* @see mapLayersByName()
* @see layers()
*/
QMap<QString, QgsMapLayer*> mapLayers() const;

/** Rerturns a list of registered map layers with a specified layer type.
/** Returns a list of registered map layers with a specified layer type.
*
* Example:
*
@@ -183,6 +183,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
* @see removeMapLayer()
* @see removeAllMapLayers()
*/
//TODO QGIS 3.0 - add PyName alias to avoid list type conversion error
void removeMapLayers( const QList<QgsMapLayer*>& layers );

/**

0 comments on commit 1a08f0a

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