From 53540998b2da9cedc9ea4fd268f0a9092ba386eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bartoletti?= Date: Wed, 22 Sep 2021 07:05:56 +0200 Subject: [PATCH] QgsFeature::setId improve documentation with a warning. fixes #44898 --- python/core/auto_generated/qgsfeature.sip.in | 6 ++++++ src/core/qgsfeature.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/python/core/auto_generated/qgsfeature.sip.in b/python/core/auto_generated/qgsfeature.sip.in index a42f8ba8840c..75db357cadf6 100644 --- a/python/core/auto_generated/qgsfeature.sip.in +++ b/python/core/auto_generated/qgsfeature.sip.in @@ -174,6 +174,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; diff --git a/src/core/qgsfeature.h b/src/core/qgsfeature.h index 25425c52f297..b972fe63d11f 100644 --- a/src/core/qgsfeature.h +++ b/src/core/qgsfeature.h @@ -224,6 +224,9 @@ class CORE_EXPORT QgsFeature * Sets the feature \a id for this feature. * \param id feature 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 );