Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add information about matching number of fields condition (#41799)
  • Loading branch information
tschmetzer committed Feb 25, 2021
1 parent 26212d2 commit 22026cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -204,13 +204,20 @@ Returns the number of attributes attached to the feature.
void setAttributes( const QgsAttributes &attrs );
%Docstring
Sets the feature's attributes.
The feature will be valid after.
The feature will be valid after. The number of provided attributes need to match exactly the
number of the feature's fields.

:param attrs: attribute list
:param attrs: List of attribute values

.. seealso:: :py:func:`setAttribute`

.. seealso:: :py:func:`attributes`

.. warning::

Method will return false if the number of provided attributes does not exactly match
the number of the feature's fields and it will not be possible to add this feature to the data
provider.
%End

bool setAttribute( int field, const QVariant &attr /GetWrapper/ );
Expand Down
8 changes: 6 additions & 2 deletions src/core/qgsfeature.h
Expand Up @@ -245,10 +245,14 @@ class CORE_EXPORT QgsFeature

/**
* Sets the feature's attributes.
* The feature will be valid after.
* \param attrs attribute list
* The feature will be valid after. The number of provided attributes need to match exactly the
* number of the feature's fields.
* \param attrs List of attribute values
* \see setAttribute
* \see attributes
* \warning Method will return false if the number of provided attributes does not exactly match
* the number of the feature's fields and it will not be possible to add this feature to the data
* provider.
*/
void setAttributes( const QgsAttributes &attrs );

Expand Down

0 comments on commit 22026cc

Please sign in to comment.