Skip to content

Commit b5b16df

Browse files
committed
Adjust docstrings
1 parent 2b9ffa1 commit b5b16df

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

python/core/auto_generated/qgsfeaturesource.sip.in

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ An interface for objects which provide features via a getFeatures method.
2222
#include "qgsfeaturesource.h"
2323
%End
2424
public:
25+
2526
enum FeatureAvailability
2627
{
2728
NoFeaturesAvailable,

python/core/auto_generated/qgsvectorlayer.sip.in

+5-6
Original file line numberDiff line numberDiff line change
@@ -946,13 +946,12 @@ Determines if this vector layer has features.
946946

947947
.. warning::
948948

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

955-
.. versionadded:: 3.2
954+
.. versionadded:: 3.4
956955
%End
957956

958957
void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag = false ) /Deprecated/;

src/core/qgsfeaturesource.h

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class QgsFeedback;
3737
class CORE_EXPORT QgsFeatureSource
3838
{
3939
public:
40+
41+
/**
42+
* Return value for hasFeatures() to determine if a source is empty.
43+
* It is implemented as a three-value logic, so it can return if
44+
* there are features available for sure, if there are no features
45+
* available for sure or if there might be features available but
46+
* there is no guarantee for this.
47+
*
48+
* \since QGIS 3.4
49+
*/
4050
enum FeatureAvailability
4151
{
4252
NoFeaturesAvailable, //!< There are certainly no features available in this source

src/core/qgsvectorlayer.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -932,13 +932,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
932932
/**
933933
* Determines if this vector layer has features.
934934
*
935-
* \warning A layer is considered empty if neither the data provider nor
936-
* the edit buffer have features in them.
937-
* This means the returned value may be inaccurate for layers with unsaved changes,
938-
* i.e. in the case of all features from the data provider having been
939-
* deleted within the edit buffer.
935+
* \warning when a layer is editable and some features
936+
* have been deleted, this will return
937+
* QgsFeatureSource::FeatureAvailability::FeaturesMayBeAvailable
938+
* to avoid a potentially expensive call to the dataprovider.
940939
*
941-
* \since QGIS 3.2
940+
* \since QGIS 3.4
942941
*/
943942
FeatureAvailability hasFeatures() const override;
944943

src/providers/postgres/qgspostgresprovider.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
115115
* \note In contrast to the featureCount() method, this method is not
116116
* affected by estimated metadata.
117117
*
118-
* \since QGIS 3.2
118+
* \since QGIS 3.4
119119
*/
120120
bool empty() const override;
121121

0 commit comments

Comments
 (0)