QgsFeatureIterator class

Wrapper for iterator of features from vector data provider or vector layer.

Constructors, destructors, conversion operators

QgsFeatureIterator() defaulted
Construct invalid iterator.
QgsFeatureIterator(QgsAbstractFeatureIterator* iter)
Construct a valid iterator.
QgsFeatureIterator(const QgsFeatureIterator& fi)
Copy constructor copies the iterator, increases ref.count.
~QgsFeatureIterator()
Destructor deletes the iterator if it has no more references.

Public functions

auto compileFailed() const -> bool
Indicator if there was an error when sending the compiled query to the server.
auto compileStatus() const -> QgsAbstractFeatureIterator::CompileStatus
Returns the status of expression compilation for filter expression requests.
auto isClosed() const -> bool
find out whether the iterator is still valid or closed already
auto isValid() const -> bool virtual
Will return if this iterator is valid.
void setInterruptionChecker(QgsFeedback* interruptionChecker)
Attach an object that can be queried regularly by the iterator to check if it must stopped.

Function documentation

bool QgsFeatureIterator::compileFailed() const

Indicator if there was an error when sending the compiled query to the server.

This indicates that there is something wrong with the expression compiler.

QgsAbstractFeatureIterator::CompileStatus QgsFeatureIterator::compileStatus() const

Returns the status of expression compilation for filter expression requests.

bool QgsFeatureIterator::isValid() const virtual

Will return if this iterator is valid.

An invalid iterator was probably introduced by a failed attempt to acquire a connection or is a default constructed iterator.

void QgsFeatureIterator::setInterruptionChecker(QgsFeedback* interruptionChecker)

Attach an object that can be queried regularly by the iterator to check if it must stopped.

This is mostly useful for iterators where a single nextFeature()/fetchFeature() iteration might be very long. A typical use case is the WFS provider.