Skip to content
Permalink
Browse files

add QgsFeatureRequest::setNoAttributes (#8326)

since it's more convenient than setSubsetOfAttributes( QgsAttributesList() )
  • Loading branch information
3nids committed Oct 25, 2018
1 parent 653a668 commit 699d8487dc98616bf76dbac409b5a5ba7ab8fcfb
@@ -513,6 +513,15 @@ Set a subset of attributes that will be fetched.
An empty attributes list indicates that no attributes will be fetched.
To revert a call to setSubsetOfAttributes and fetch all available attributes,
the SubsetOfAttributes flag should be removed from the request.
%End

QgsFeatureRequest &setNoAttributes();
%Docstring
Set that no attributes will be fetched.
To revert a call to setNoAttributes and fetch all or some available attributes,
the SubsetOfAttributes flag should be removed from the request.

.. versionadded:: 3.4
%End

QgsAttributeList subsetOfAttributes() const;
@@ -190,6 +190,11 @@ QgsFeatureRequest &QgsFeatureRequest::setSubsetOfAttributes( const QgsAttributeL
return *this;
}

QgsFeatureRequest &QgsFeatureRequest::setNoAttributes()
{
return setSubsetOfAttributes( QgsAttributeList() );
}

QgsFeatureRequest &QgsFeatureRequest::setSubsetOfAttributes( const QStringList &attrNames, const QgsFields &fields )
{
if ( attrNames.contains( QgsFeatureRequest::ALL_ATTRIBUTES ) )
@@ -501,6 +501,14 @@ class CORE_EXPORT QgsFeatureRequest
*/
QgsFeatureRequest &setSubsetOfAttributes( const QgsAttributeList &attrs );

/**
* Set that no attributes will be fetched.
* To revert a call to setNoAttributes and fetch all or some available attributes,
* the SubsetOfAttributes flag should be removed from the request.
* \since QGIS 3.4
*/
QgsFeatureRequest &setNoAttributes();

/**
* Returns the subset of attributes which at least need to be fetched
* \returns A list of attributes to be fetched

0 comments on commit 699d848

Please sign in to comment.
You can’t perform that action at this time.