The QSequentialIterable class is an iterable interface for a container in a QVariant. More...
Header: | #include <QSequentialIterable> |
qmake: | QT += core |
Since: | Qt 5.2 |
class | const_iterator |
QVariant | at(int idx) const |
QSequentialIterable::const_iterator | begin() const |
bool | canReverseIterate() const |
QSequentialIterable::const_iterator | end() const |
int | size() const |
The QSequentialIterable class is an iterable interface for a container in a QVariant.
This class allows several methods of accessing the elements of a container held within a QVariant. An instance of QSequentialIterable can be extracted from a QVariant if it can be converted to a QVariantList.
QList<int> intList = {7, 11, 42}; QVariant variant = QVariant::fromValue(intList); if (variant.canConvert<QVariantList>()) { QSequentialIterable iterable = variant.value<QSequentialIterable>(); // Can use foreach: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QSequentialIterable::const_iterator it = iterable.begin(); const QSequentialIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; } }
The container itself is not copied before iterating over it.
See also QVariant.
Returns the element at position idx in the container.
Returns a QSequentialIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration.
See also end().
Returns whether it is possible to iterate over the container in reverse. This corresponds to the std::bidirectional_iterator_tag iterator trait of the const_iterator of the container.
Returns a QSequentialIterable::const_iterator for the end of the container. This can be used in stl-style iteration.
See also begin().
Returns the number of elements in the container.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: