Skip to content
Permalink
Browse files

Adjust docstrings

  • Loading branch information
m-kuhn committed Jun 4, 2018
1 parent 2b9ffa1 commit b5b16dfaa54092d636c349ee5e0588a608e1a84d
@@ -22,6 +22,7 @@ An interface for objects which provide features via a getFeatures method.
#include "qgsfeaturesource.h"
%End
public:

enum FeatureAvailability
{
NoFeaturesAvailable,
@@ -946,13 +946,12 @@ Determines if this vector layer has features.

.. warning::

A layer is considered empty if neither the data provider nor
the edit buffer have features in them.
This means the returned value may be inaccurate for layers with unsaved changes,
i.e. in the case of all features from the data provider having been
deleted within the edit buffer.
when a layer is editable and some features
have been deleted, this will return
QgsFeatureSource.FeatureAvailability.FeaturesMayBeAvailable
to avoid a potentially expensive call to the dataprovider.

.. versionadded:: 3.2
.. versionadded:: 3.4
%End

void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false ) /Deprecated/;
@@ -37,6 +37,16 @@ class QgsFeedback;
class CORE_EXPORT QgsFeatureSource
{
public:

/**
* Return value for hasFeatures() to determine if a source is empty.
* It is implemented as a three-value logic, so it can return if
* there are features available for sure, if there are no features
* available for sure or if there might be features available but
* there is no guarantee for this.
*
* \since QGIS 3.4
*/
enum FeatureAvailability
{
NoFeaturesAvailable, //!< There are certainly no features available in this source
@@ -932,13 +932,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
/**
* Determines if this vector layer has features.
*
* \warning A layer is considered empty if neither the data provider nor
* the edit buffer have features in them.
* This means the returned value may be inaccurate for layers with unsaved changes,
* i.e. in the case of all features from the data provider having been
* deleted within the edit buffer.
* \warning when a layer is editable and some features
* have been deleted, this will return
* QgsFeatureSource::FeatureAvailability::FeaturesMayBeAvailable
* to avoid a potentially expensive call to the dataprovider.
*
* \since QGIS 3.2
* \since QGIS 3.4
*/
FeatureAvailability hasFeatures() const override;

@@ -115,7 +115,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
* \note In contrast to the featureCount() method, this method is not
* affected by estimated metadata.
*
* \since QGIS 3.2
* \since QGIS 3.4
*/
bool empty() const override;

0 comments on commit b5b16df

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