Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
Iterable Class Reference

\inherits QIterable More...

Collaboration diagram for Iterable:

Detailed Description

\inherits QIterable

Since
6.11 \inmodule QtCore

The QMetaSequence::Iterable class is an iterable interface for a container in a QVariant.

This class allows several methods of accessing the values of a container held within a QVariant. An instance of QMetaSequence::Iterable can be extracted from a QVariant if it can be converted to a QVariantList, or if the container it contains is registered using Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE. Most sequential containers found in Qt and some found in the C++ standard library are automatically registered.

QList<int> intList = {7, 11, 42};
// Can use C++11 range-for:
for (const QVariant &v : iterable) {
qDebug() << v;
}
// Can use iterators:
for ( ; it != end; ++it) {
qDebug() << *it;
}
}

The container itself is not copied before iterating over it.

See also
QVariant

The documentation for this class was generated from the following file: