diff --git a/python/core/qgsproject.sip b/python/core/qgsproject.sip index 770f68a674b..4733e8d4618 100644 --- a/python/core/qgsproject.sip +++ b/python/core/qgsproject.sip @@ -412,14 +412,7 @@ class QgsProject : QObject, QgsExpressionContextGenerator void setCustomVariables( const QVariantMap& customVariables ); int count() const; - /** Retrieve a pointer to a registered layer by layer ID. - * @param theLayerId ID of layer to retrieve - * @returns matching layer, or nullptr if no matching layer found - * @see mapLayersByName() - * @see mapLayers() - */ - //TODO QGIS 3.0 - rename theLayerId to layerId - QgsMapLayer* mapLayer( const QString& theLayerId ) const; + QgsMapLayer* mapLayer( const QString& layerId ) const; /** Retrieve a list of matching registered layers by layer name. * @param layerName name of layers to match @@ -436,79 +429,12 @@ class QgsProject : QObject, QgsExpressionContextGenerator */ QMap mapLayers() const; - /** - * @brief - * Add a list of layers to the map of loaded layers. - * - * The layersAdded() and layerWasAdded() signals will always be emitted. - * The legendLayersAdded() signal is emitted only if addToLegend is true. - * - * @param theMapLayers A list of layer which should be added to the registry - * @param addToLegend If true (by default), the layers will be added to the - * legend and to the main canvas. If you have a private - * layer you can set this parameter to false to hide it. - * @param takeOwnership Ownership will be transferred to the layer registry. - * If you specify false here you have take care of deleting - * the layers yourself. Not available in python. - * - * @return a list of the map layers that were added - * successfully. If a layer is invalid, or already exists in the registry, - * it will not be part of the returned QList. - * - * @note As a side-effect QgsProject is made dirty. - * @note takeOwnership is not available in the Python bindings - the registry will always - * take ownership - * @note added in QGIS 1.8 - * @see addMapLayer() - */ - QList addMapLayers( const QList& theMapLayers /Transfer/, + QList addMapLayers( const QList& layers /Transfer/, bool addToLegend = true ); - /** - * @brief - * Add a layer to the map of loaded layers. - * - * The layersAdded() and layerWasAdded() signals will always be emitted. - * The legendLayersAdded() signal is emitted only if addToLegend is true. - * If you are adding multiple layers at once, you should use - * addMapLayers() instead. - * - * @param theMapLayer A layer to add to the registry - * @param addToLegend If true (by default), the layer will be added to the - * legend and to the main canvas. If you have a private - * layer you can set this parameter to false to hide it. - * @param takeOwnership Ownership will be transferred to the layer registry. - * If you specify false here you have take care of deleting - * the layer yourself. Not available in python. - * - * @return nullptr if unable to add layer, otherwise pointer to newly added layer - * - * @see addMapLayers - * - * @note As a side-effect QgsProject is made dirty. - * @note Use addMapLayers if adding more than one layer at a time - * @note takeOwnership is not available in the Python bindings - the registry will always - * take ownership - * @see addMapLayers() - */ - QgsMapLayer* addMapLayer( QgsMapLayer * theMapLayer /Transfer/, bool addToLegend = true ); + QgsMapLayer* addMapLayer( QgsMapLayer * layer /Transfer/, bool addToLegend = true ); - /** - * @brief - * Remove a set of layers from the registry by layer ID. - * - * The specified layers will be removed from the registry. If the registry has ownership - * of any layers these layers will also be deleted. - * - * @param theLayerIds list of IDs of the layers to remove - * - * @note As a side-effect the QgsProject instance is marked dirty. - * @note added in QGIS 1.8 - * @see removeMapLayer() - * @see removeAllMapLayers() - */ - // TODO QGIS 3.0 - rename theLayerIds to layerIds - void removeMapLayers( const QStringList& theLayerIds ); + void removeMapLayers( const QStringList& layerIds ); /** * @brief @@ -525,21 +451,7 @@ class QgsProject : QObject, QgsExpressionContextGenerator */ void removeMapLayers( const QList& layers ); - /** - * @brief - * Remove a layer from the registry by layer ID. - * - * The specified layer will be removed from the registry. If the registry has ownership - * of the layer then it will also be deleted. - * - * @param theLayerId ID of the layer to remove - * - * @note As a side-effect the QgsProject instance is marked dirty. - * @see removeMapLayers() - * @see removeAllMapLayers() - */ - // TODO QGIS 3.0 - rename theLayerId to layerId - void removeMapLayer( const QString& theLayerId ); + void removeMapLayer( const QString& layerId ); /** * @brief @@ -673,15 +585,7 @@ class QgsProject : QObject, QgsExpressionContextGenerator // signals from QgsMapLayerRegistry // - /** - * Emitted when one or more layers are about to be removed from the registry. - * - * @param theLayerIds A list of IDs for the layers which are to be removed. - * @see layerWillBeRemoved() - * @see layersRemoved() - */ - // TODO QGIS 3.0 - rename theLayerIds to layerIds - void layersWillBeRemoved( const QStringList& theLayerIds ); + void layersWillBeRemoved( const QStringList& layerIds ); /** * Emitted when one or more layers are about to be removed from the registry. @@ -692,17 +596,7 @@ class QgsProject : QObject, QgsExpressionContextGenerator */ void layersWillBeRemoved( const QList& layers ); - /** - * Emitted when a layer is about to be removed from the registry. - * - * @param theLayerId The ID of the layer to be removed. - * - * @note Consider using {@link layersWillBeRemoved()} instead - * @see layersWillBeRemoved() - * @see layerRemoved() - */ - //TODO QGIS 3.0 - rename theLayerId to layerId - void layerWillBeRemoved( const QString& theLayerId ); + void layerWillBeRemoved( const QString& layerId ); /** * Emitted when a layer is about to be removed from the registry. @@ -715,25 +609,9 @@ class QgsProject : QObject, QgsExpressionContextGenerator */ void layerWillBeRemoved( QgsMapLayer* layer ); - /** - * Emitted after one or more layers were removed from the registry. - * - * @param theLayerIds A list of IDs of the layers which were removed. - * @see layersWillBeRemoved() - */ - //TODO QGIS 3.0 - rename theLayerIds to layerIds - void layersRemoved( const QStringList& theLayerIds ); + void layersRemoved( const QStringList& layerIds ); - /** - * Emitted after a layer was removed from the registry. - * - * @param theLayerId The ID of the layer removed. - * - * @note Consider using {@link layersRemoved()} instead - * @see layerWillBeRemoved() - */ - //TODO QGIS 3.0 - rename theLayerId to layerId - void layerRemoved( const QString& theLayerId ); + void layerRemoved( const QString& layerId ); /** * Emitted when all layers are removed, before {@link layersWillBeRemoved()} and @@ -744,40 +622,11 @@ class QgsProject : QObject, QgsExpressionContextGenerator //TODO QGIS 3.0 - rename to past tense void removeAll(); - /** - * Emitted when one or more layers were added to the registry. - * This signal is also emitted for layers added to the registry, - * but not to the legend. - * - * @param theMapLayers List of layers which have been added. - * - * @see legendLayersAdded() - * @see layerWasAdded() - */ - //TODO QGIS 3.0 - rename theMapLayers to mapLayers - void layersAdded( const QList& theMapLayers ); + void layersAdded( const QList& layers ); - /** - * Emitted when a layer was added to the registry. - * - * @param theMapLayer The ID of the layer which has been added. - * - * @note Consider using {@link layersAdded()} instead - * @see layersAdded() - */ - // TODO QGIS 3.0 - rename theMapLayer to layer - void layerWasAdded( QgsMapLayer* theMapLayer ); + void layerWasAdded( QgsMapLayer* layer ); - /** - * Emitted, when a layer was added to the registry and the legend. - * Layers can also be private layers, which are signalled by - * {@link layersAdded()} and {@link layerWasAdded()} but will not be - * advertised by this signal. - * - * @param theMapLayers List of {@link QgsMapLayer}s which were added to the legend. - */ - //TODO QGIS 3.0 rename theMapLayers to mapLayers - void legendLayersAdded( const QList& theMapLayers ); + void legendLayersAdded( const QList& layers ); public slots: /** diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 978606fbc44..643dcdb745c 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -2001,9 +2001,9 @@ int QgsProject::count() const return mMapLayers.size(); } -QgsMapLayer * QgsProject::mapLayer( const QString& theLayerId ) const +QgsMapLayer * QgsProject::mapLayer( const QString& layerId ) const { - return mMapLayers.value( theLayerId ); + return mMapLayers.value( layerId ); } QList QgsProject::mapLayersByName( const QString& layerName ) const @@ -2020,12 +2020,12 @@ QList QgsProject::mapLayersByName( const QString& layerName ) con } QList QgsProject::addMapLayers( - const QList& theMapLayers, + const QList& layers, bool addToLegend, bool takeOwnership ) { QList myResultList; - Q_FOREACH ( QgsMapLayer* myLayer, theMapLayers ) + Q_FOREACH ( QgsMapLayer* myLayer, layers ) { if ( !myLayer || !myLayer->isValid() ) { @@ -2056,19 +2056,19 @@ QList QgsProject::addMapLayers( } QgsMapLayer * -QgsProject::addMapLayer( QgsMapLayer* theMapLayer, +QgsProject::addMapLayer( QgsMapLayer* layer, bool addToLegend, bool takeOwnership ) { QList addedLayers; - addedLayers = addMapLayers( QList() << theMapLayer, addToLegend, takeOwnership ); + addedLayers = addMapLayers( QList() << layer, addToLegend, takeOwnership ); return addedLayers.isEmpty() ? nullptr : addedLayers[0]; } -void QgsProject::removeMapLayers( const QStringList& theLayerIds ) +void QgsProject::removeMapLayers( const QStringList& layerIds ) { QList layers; - Q_FOREACH ( const QString &myId, theLayerIds ) + Q_FOREACH ( const QString &myId, layerIds ) { layers << mMapLayers.value( myId ); } @@ -2116,9 +2116,9 @@ void QgsProject::removeMapLayers( const QList& layers ) emit layersRemoved( layerIds ); } -void QgsProject::removeMapLayer( const QString& theLayerId ) +void QgsProject::removeMapLayer( const QString& layerId ) { - removeMapLayers( QList() << mMapLayers.value( theLayerId ) ); + removeMapLayers( QList() << mMapLayers.value( layerId ) ); } void QgsProject::removeMapLayer( QgsMapLayer* layer ) diff --git a/src/core/qgsproject.h b/src/core/qgsproject.h index eaeeaab7aa1..f534c14bc24 100644 --- a/src/core/qgsproject.h +++ b/src/core/qgsproject.h @@ -509,13 +509,12 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera int count() const; /** Retrieve a pointer to a registered layer by layer ID. - * @param theLayerId ID of layer to retrieve + * @param layerId ID of layer to retrieve * @returns matching layer, or nullptr if no matching layer found * @see mapLayersByName() * @see mapLayers() */ - //TODO QGIS 3.0 - rename theLayerId to layerId - QgsMapLayer* mapLayer( const QString& theLayerId ) const; + QgsMapLayer* mapLayer( const QString& layerId ) const; /** Retrieve a list of matching registered layers by layer name. * @param layerName name of layers to match @@ -623,15 +622,14 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera * The specified layers will be removed from the registry. If the registry has ownership * of any layers these layers will also be deleted. * - * @param theLayerIds list of IDs of the layers to remove + * @param layerIds list of IDs of the layers to remove * * @note As a side-effect the QgsProject instance is marked dirty. * @note added in QGIS 1.8 * @see removeMapLayer() * @see removeAllMapLayers() */ - // TODO QGIS 3.0 - rename theLayerIds to layerIds - void removeMapLayers( const QStringList& theLayerIds ); + void removeMapLayers( const QStringList& layerIds ); /** * @brief @@ -656,14 +654,13 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera * The specified layer will be removed from the registry. If the registry has ownership * of the layer then it will also be deleted. * - * @param theLayerId ID of the layer to remove + * @param layerId ID of the layer to remove * * @note As a side-effect the QgsProject instance is marked dirty. * @see removeMapLayers() * @see removeAllMapLayers() */ - // TODO QGIS 3.0 - rename theLayerId to layerId - void removeMapLayer( const QString& theLayerId ); + void removeMapLayer( const QString& layerId ); /** * @brief @@ -800,12 +797,11 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera /** * Emitted when one or more layers are about to be removed from the registry. * - * @param theLayerIds A list of IDs for the layers which are to be removed. + * @param layerIds A list of IDs for the layers which are to be removed. * @see layerWillBeRemoved() * @see layersRemoved() */ - // TODO QGIS 3.0 - rename theLayerIds to layerIds - void layersWillBeRemoved( const QStringList& theLayerIds ); + void layersWillBeRemoved( const QStringList& layerIds ); /** * Emitted when one or more layers are about to be removed from the registry. @@ -819,14 +815,13 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera /** * Emitted when a layer is about to be removed from the registry. * - * @param theLayerId The ID of the layer to be removed. + * @param layerId The ID of the layer to be removed. * * @note Consider using {@link layersWillBeRemoved()} instead * @see layersWillBeRemoved() * @see layerRemoved() */ - //TODO QGIS 3.0 - rename theLayerId to layerId - void layerWillBeRemoved( const QString& theLayerId ); + void layerWillBeRemoved( const QString& layerId ); /** * Emitted when a layer is about to be removed from the registry. @@ -842,22 +837,20 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera /** * Emitted after one or more layers were removed from the registry. * - * @param theLayerIds A list of IDs of the layers which were removed. + * @param layerIds A list of IDs of the layers which were removed. * @see layersWillBeRemoved() */ - //TODO QGIS 3.0 - rename theLayerIds to layerIds - void layersRemoved( const QStringList& theLayerIds ); + void layersRemoved( const QStringList& layerIds ); /** * Emitted after a layer was removed from the registry. * - * @param theLayerId The ID of the layer removed. + * @param layerId The ID of the layer removed. * * @note Consider using {@link layersRemoved()} instead * @see layerWillBeRemoved() */ - //TODO QGIS 3.0 - rename theLayerId to layerId - void layerRemoved( const QString& theLayerId ); + void layerRemoved( const QString& layerId ); /** * Emitted when all layers are removed, before {@link layersWillBeRemoved()} and @@ -873,24 +866,20 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera * This signal is also emitted for layers added to the registry, * but not to the legend. * - * @param theMapLayers List of layers which have been added. + * @param layers List of layers which have been added. * * @see legendLayersAdded() * @see layerWasAdded() */ - //TODO QGIS 3.0 - rename theMapLayers to mapLayers - void layersAdded( const QList& theMapLayers ); + void layersAdded( const QList& layers ); /** * Emitted when a layer was added to the registry. * - * @param theMapLayer The ID of the layer which has been added. - * * @note Consider using {@link layersAdded()} instead * @see layersAdded() */ - // TODO QGIS 3.0 - rename theMapLayer to layer - void layerWasAdded( QgsMapLayer* theMapLayer ); + void layerWasAdded( QgsMapLayer* layer ); /** * Emitted, when a layer was added to the registry and the legend. @@ -898,10 +887,9 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera * {@link layersAdded()} and {@link layerWasAdded()} but will not be * advertised by this signal. * - * @param theMapLayers List of {@link QgsMapLayer}s which were added to the legend. + * @param layers List of {@link QgsMapLayer}s which were added to the legend. */ - //TODO QGIS 3.0 rename theMapLayers to mapLayers - void legendLayersAdded( const QList& theMapLayers ); + void legendLayersAdded( const QList& layers ); public slots: