Skip to content

Commit

Permalink
QgsFeature::setId improve documentation with a warning. fixes #44898
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 22, 2021
1 parent 83f3927 commit 7dc1338
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -177,6 +177,12 @@ Sets the feature ID for this feature.
:param id: feature id

.. seealso:: :py:func:`id`

.. warning::

Feature IDs will be automatically changed whenever a feature is added to vector layer or data provider.
This method is not designed to allow a specific feature ID to be assigned to a feature which will be added to a
layer or data provider, and the results will be unpredictable
%End

QgsAttributes attributes() const;
Expand Down
5 changes: 4 additions & 1 deletion src/core/qgsfeature.h
Expand Up @@ -224,7 +224,10 @@ class CORE_EXPORT QgsFeature
/**
* Sets the feature ID for this feature.
* \param id feature id
* \see id
* \see id()
* \warning Feature IDs will be automatically changed whenever a feature is added to vector layer or data provider.
* This method is not designed to allow a specific feature ID to be assigned to a feature which will be added to a
* layer or data provider, and the results will be unpredictable
*/
void setId( QgsFeatureId id );

Expand Down

0 comments on commit 7dc1338

Please sign in to comment.