QMetaSequence::Iterable::ConstIterator Class | Qt Core | Qt 6.11.2
Description: QMetaSequence::Iterable::ConstIterator allows iteration over a container in a QVariant.

- Qt 6.11
- Qt Core
- C++ Classes
- ConstIterator
- Qt 6.11.2 Reference Documentation

# QMetaSequence::Iterable::ConstIterator Class

class QMetaSequence::Iterable::ConstIterator

QMetaSequence::Iterable::ConstIterator allows iteration over a container in a QVariant. More...

This class was introduced in Qt 6.11.

- List of all members, including inherited members

## Public Functions

QVariant | operator*() const
int | operator->() const
QVariant | operator[](qsizetype n) const

## Detailed Description

A QMetaSequence::Iterable::ConstIterator can only be created by a QMetaSequence::Iterable instance, and can be used in a way similar to other stl-style iterators.

     QList<int> intList = {7, 11, 42};

     QVariant variant = QVariant::fromValue(intList);
     if (variant.canConvert<QVariantList>()) {
         QMetaSequence::Iterable iterable = variant.value<QMetaSequence::Iterable>();
         // Can use C++11 range-for:
         for (const QVariant &v : iterable) {
             qDebug() << v;
         }
         // Can use iterators:
         QMetaSequence::Iterable::const_iterator it = iterable.begin();
         const QMetaSequence::Iterable::const_iterator end = iterable.end();
         for ( ; it != end; ++it) {
             qDebug() << *it;
         }
     }

## Member Function Documentation

### QVariant ConstIterator::operator*() const

Returns the current item, converted to a QVariant.

### int ConstIterator::operator->() const

Returns the current item, converted to a QVariant::ConstPointer.

### QVariant ConstIterator::operator[](qsizetype n) const

Returns the item offset from the current one by n, converted to a QVariant.