5 Commits

Author SHA1 Message Date
Martin Dobias
4c8b801791 Make sure that bool(obj) is True for QGIS API objects
bool(obj) in Python has the following semantics:
1. if the object has __bool__() method, return its value
2. if the object has __len__() method, return its value
3. return True

So for objects in QGIS API that implement __len__() method, we were getting
unexpected behavior - for example, "if layer: ..." would evaluate as False
in case the layer was empty, while the usual expectation is that any reference
to an object that is not None should evaluate to True.
2018-06-28 11:04:50 +02:00
Matthias Kuhn
b5b16dfaa5
Adjust docstrings 2018-06-04 08:59:33 +02:00
Matthias Kuhn
5fb9d14ce7
QgsFeatureSource::hasFeatures() -> Yes, No, Maybe
This method allows to determine if a feature source has content or not
(or maybe).

This method works for "generator" sources as well as for "collection"
sources.

Collection sources like QgsVectorDataProvider which allow to easily and
in a cheap way determine if features are available can return
FeaturesAvailable or NoFeaturesAvailable, generators will return
FeaturesMaybeAvailable.

QgsVectorDataProvider also implements an empty() method.
2018-06-04 08:59:30 +02:00
Matthias Kuhn
e252cc0ce9
Add empty() and emptyUnknown() to QgsFeatureSource 2018-06-04 08:59:27 +02:00
Denis Rouzaud
7df2593caf move auto generated sip file in dedicated folder 2018-05-14 10:23:37 -04:00