File tree 3 files changed +24
-2
lines changed
3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ class QgsMapLayerRegistry : QObject
44
44
QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers /Transfer/,
45
45
bool theEmitSignal = true );
46
46
47
+ /** Add a layer to the map of loaded layers
48
+ @returns NULL if unable to add layer, otherwise pointer to newly added layer
49
+ @see addMapLayers
50
+ @note Use addMapLayers if adding more than one layer at a time
51
+ */
52
+ QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer /Transfer/, bool theEmitSignal = true ) /Deprecated/;
47
53
48
54
/** Remove a set of layers from qgis
49
55
@note As a side-effect QgsProject is made dirty.
@@ -57,7 +63,6 @@ class QgsMapLayerRegistry : QObject
57
63
*/
58
64
void removeMapLayers( QStringList theLayerIds, bool theEmitSignal = true );
59
65
60
-
61
66
/** Remove all registered layers
62
67
@note raises removedAll()
63
68
As a side-effect QgsProject is made dirty.
Original file line number Diff line number Diff line change @@ -104,6 +104,18 @@ QList<QgsMapLayer *> QgsMapLayerRegistry::addMapLayers(
104
104
return myResultList;
105
105
} // QgsMapLayerRegistry::addMapLayers
106
106
107
+ // this is just a thin wrapper for addMapLayers
108
+ QgsMapLayer *
109
+ QgsMapLayerRegistry::addMapLayer ( QgsMapLayer * theMapLayer,
110
+ bool theEmitSignal )
111
+ {
112
+ QList<QgsMapLayer *> myList, myList2;
113
+ myList.append ( theMapLayer );
114
+ myList2 = addMapLayers ( myList, theEmitSignal );
115
+ return myList2.isEmpty () ? 0 : myList2[0 ];
116
+ }
117
+
118
+
107
119
// introduced in 1.8
108
120
void QgsMapLayerRegistry::removeMapLayers ( QStringList theLayerIds,
109
121
bool theEmitSignal )
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
67
67
QList<QgsMapLayer *> addMapLayers ( QList<QgsMapLayer *> theMapLayers,
68
68
bool theEmitSignal = true );
69
69
70
+ /* * Add a layer to the map of loaded layers
71
+ @returns NULL if unable to add layer, otherwise pointer to newly added layer
72
+ @see addMapLayers
73
+ @note addMapLayers is prefered and must be used if adding more than one layer at a time
74
+ */
75
+ Q_DECL_DEPRECATED QgsMapLayer *addMapLayer ( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
70
76
71
77
/* * Remove a set of layers from qgis
72
78
@note As a side-effect QgsProject is made dirty.
@@ -80,7 +86,6 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
80
86
*/
81
87
void removeMapLayers ( QStringList theLayerIds, bool theEmitSignal = true );
82
88
83
-
84
89
/* * Remove all registered layers
85
90
@note raises removedAll()
86
91
As a side-effect QgsProject is made dirty.
You can’t perform that action at this time.
0 commit comments