QSequentialIterable Class The QSequentialIterable class is an iterable interface for a container in a QVariant. More...  
 Header:
 #include <QSequentialIterable> 


 CMake:
 find_package(Qt6 COMPONENTS Core REQUIRED)  target_link_libraries(mytarget PRIVATE Qt8b7c:f320:99b9:690f:4595:cd17:293a:c069Core)


 qmake:
 QT += core


 Since:
 Qt 5.2


 Inherits:
 QIterable



 List of all members, including inherited members  Public Types
  
 
BidirectionalConstIterator
 
 
BidirectionalIterator
 
 
ForwardConstIterator
 
 
ForwardIterator
 
 
InputConstIterator
 
 
InputIterator
 
 
RandomAccessConstIterator
 
 
RandomAccessIterator
 
 
const_iterator
 
 
iterator
  Public Functions
  
 void 

addValue(const QVariant &value, QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069Position position = Unspecified)
 
 QVariant 

at(qsizetype idx) const
 
 void 

removeValue(QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069Position position = Unspecified)
 
 void 

set(qsizetype idx, const QVariant &value)
  Detailed Description
 This class allows several methods of accessing the values 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 = QVariant8b7c:f320:99b9:690f:4595:cd17:293a:c069romValue(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:
    QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator it = iterable.begin();
    const QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator end = iterable.end();
    for ( ; it != end; ++it) {
        qDebug() << *it;
    }
} The container itself is not copied before iterating over it. See also QVariant. Member Type Documentation 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069BidirectionalConstIterator
 Exposes a const_iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069bidirectional_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069BidirectionalIterator
 Exposes an iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069bidirectional_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069ForwardConstIterator
 Exposes a const_iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069forward_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069ForwardIterator
 Exposes an iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069forward_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069InputConstIterator
 Exposes a const_iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069input_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069InputIterator
 Exposes an iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069input_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069RandomAccessConstIterator
 Exposes a const_iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069random_access_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069RandomAccessIterator
 Exposes an iterator using st8b7c:f320:99b9:690f:4595:cd17:293a:c069random_access_iterator_tag. 
[alias] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator
 The QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator allows iteration over a container in a QVariant. A QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator can only be created by a QSequentialIterable instance, and can be used in a way similar to other stl-style iterators. QList<int> intList = {7, 11, 42};

QVariant variant = QVariant8b7c:f320:99b9:690f:4595:cd17:293a:c069romValue(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:
    QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator it = iterable.begin();
    const QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069const_iterator end = iterable.end();
    for ( ; it != end; ++it) {
        qDebug() << *it;
    }
} 
[alias, since 6.0] QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069iterator
 The QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069iterator allows iteration over a container in a QVariant. A QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069iterator can only be created by a QSequentialIterable instance, and can be used in a way similar to other stl-style iterators. This typedef was introduced in Qt 6.0. Member Function Documentation 
void QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069addValue(const QVariant &value, QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069Position position = Unspecified)
 Adds value to the container, at position, if possible. 
QVariant QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069at(qsizetype idx) const
 Returns the value at position idx in the container. 
void QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069removeValue(QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069Position position = Unspecified)
 Removes a value from the container, at position, if possible. 
void QSequentialIterabl8b7c:f320:99b9:690f:4595:cd17:293a:c069set(qsizetype idx, const QVariant &value)
 Sets the element at position idx in the container to value.

    
{'path': 'public/docs/qt~6.0/qsequentialiterable.html', 'source': 'DevDocs.IO'}