The QSequentialIterable::const_iterator allows iteration over a container in a QVariant . 更多...
該結構在 Qt 5.2 引入。
| const_iterator (const const_iterator & other ) | |
| const_iterator & | operator= (const const_iterator & other ) |
| ~const_iterator () | |
| bool | operator!= (const const_iterator & other ) const |
| const QVariant | operator* () const |
| const_iterator | operator+ (int j ) const |
| const_iterator & | operator++ () |
| const_iterator | operator++ ( int ) |
| const_iterator & | operator+= (int j ) |
| const_iterator | operator- (int j ) const |
| const_iterator & | operator-- () |
| const_iterator | operator-- ( int ) |
| const_iterator & | operator-= (int j ) |
| bool | operator== (const const_iterator & other ) const |
A QSequentialIterable::const_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 = 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; } }
另請參閱 QSequentialIterable .
創建副本為 other .
賦值 other to this.
銷毀 QSequentialIterable::const_iterator .
返迴
true
if
other
指嚮與此迭代器不同的項;否則返迴
false
.
另請參閱 operator== ().
Returns the current item, converted to a QVariant .
Returns an iterator to the item at j positions forward from this iterator.
另請參閱 operator- () 和 operator+= ().
The prefix ++ operator (
++it
) advances the iterator to the next item in the container and returns an iterator to the new current item.
Calling this function on QSequentialIterable::end () leads to undefined results.
另請參閱 operator-- ().
這是重載函數。
The postfix ++ operator (
it++
) advances the iterator to the next item in the container and returns an iterator to the previously current item.
推進迭代器 j 項。
另請參閱 operator-= () 和 operator+ ().
Returns an iterator to the item at j positions backward from this iterator.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
另請參閱 operator+ (), operator-= (),和 canReverseIterate ().
The prefix -- operator (
--it
) makes the preceding item current and returns an iterator to the new current item.
Calling this function on QSequentialIterable::begin () leads to undefined results.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
另請參閱 operator++ () 和 canReverseIterate ().
這是重載函數。
The postfix -- operator (
it--
) makes the preceding item current and returns an iterator to the previously current item.
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
另請參閱 canReverseIterate ().
Makes the iterator go back by j 項。
If the container in the QVariant does not support bi-directional iteration, calling this function leads to undefined results.
另請參閱 operator+= (), operator- (),和 canReverseIterate ().
返迴
true
if
other
points to the same item as this iterator; otherwise returns
false
.
另請參閱 operator!= ().