Skip to content
Permalink
Browse files
[API] restore QgsMapLayerRegistry::addMapLayer() but keep it deprecated
  • Loading branch information
etiennesky committed Feb 1, 2013
1 parent b74cb5f commit aae400ecf1b52ee042103cf8676a99a73c93a947
Showing with 24 additions and 2 deletions.
  1. +6 −1 python/core/qgsmaplayerregistry.sip
  2. +12 −0 src/core/qgsmaplayerregistry.cpp
  3. +6 −1 src/core/qgsmaplayerregistry.h
@@ -44,6 +44,12 @@ class QgsMapLayerRegistry : QObject
QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers /Transfer/,
bool theEmitSignal = true );

/** Add a layer to the map of loaded layers
@returns NULL if unable to add layer, otherwise pointer to newly added layer
@see addMapLayers
@note Use addMapLayers if adding more than one layer at a time
*/
QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer /Transfer/, bool theEmitSignal = true ) /Deprecated/;

/** Remove a set of layers from qgis
@note As a side-effect QgsProject is made dirty.
@@ -57,7 +63,6 @@ class QgsMapLayerRegistry : QObject
*/
void removeMapLayers( QStringList theLayerIds, bool theEmitSignal = true );


/** Remove all registered layers
@note raises removedAll()
As a side-effect QgsProject is made dirty.
@@ -104,6 +104,18 @@ QList<QgsMapLayer *> QgsMapLayerRegistry::addMapLayers(
return myResultList;
} // QgsMapLayerRegistry::addMapLayers

//this is just a thin wrapper for addMapLayers
QgsMapLayer *
QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer,
bool theEmitSignal )
{
QList<QgsMapLayer *> myList, myList2;
myList.append( theMapLayer );
myList2 = addMapLayers( myList, theEmitSignal );
return myList2.isEmpty() ? 0 : myList2[0];
}


//introduced in 1.8
void QgsMapLayerRegistry::removeMapLayers( QStringList theLayerIds,
bool theEmitSignal )
@@ -67,6 +67,12 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers,
bool theEmitSignal = true );

/** Add a layer to the map of loaded layers
@returns NULL if unable to add layer, otherwise pointer to newly added layer
@see addMapLayers
@note addMapLayers is prefered and must be used if adding more than one layer at a time
*/
Q_DECL_DEPRECATED QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );

/** Remove a set of layers from qgis
@note As a side-effect QgsProject is made dirty.
@@ -80,7 +86,6 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
*/
void removeMapLayers( QStringList theLayerIds, bool theEmitSignal = true );


/** Remove all registered layers
@note raises removedAll()
As a side-effect QgsProject is made dirty.

0 comments on commit aae400e

Please sign in to comment.