Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[API] restore QgsMapLayerRegistry::addMapLayer() but keep it deprecated
  • Loading branch information
etiennesky committed Feb 1, 2013
1 parent b74cb5f commit aae400e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 6 additions & 1 deletion python/core/qgsmaplayerregistry.sip
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions src/core/qgsmaplayerregistry.cpp
Expand Up @@ -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 )
Expand Down
7 changes: 6 additions & 1 deletion src/core/qgsmaplayerregistry.h
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit aae400e

Please sign in to comment.