QMetaSequence::Iterable::ConstIterator Class
class QMetaSequence::Iterable::ConstIteratorQMetaSequence::Iterable::ConstIterator QVariant 에서 컨테이너를 반복 처리할 수 있게 해줍니다. 더 보기...
이 클래스는 Qt 6.11에서 도입되었습니다.
공개 함수
| QVariant | operator*() const |
| int | operator->() const |
| QVariant | operator[](qsizetype n) const |
상세 설명
QMetaSequence::Iterable::ConstIterator 는 QMetaSequence::Iterable 인스턴스에 의해서만 생성될 수 있으며, 다른 STL 스타일의 이터레이터와 유사한 방식으로 사용할 수 있습니다.
QList<int> intList = {7, 11, 42};
QVariant variant = QVariant::fromValue(intList);
if (variant.canConvert<QVariantList>()) {
QMetaSequence::Iterable iterable = variant.value<QMetaSequence::Iterable>();
// C++11 범위 for 문 사용 가능:
for (const QVariant&v: iterable) {
qDebug() << v;
}
// 반복자를 사용할 수 있습니다:
QMetaSequence::Iterable::const_iteratorit = iterable.begin();
const QMetaSequence::Iterable::const_iteratorend = iterable.end();
for ( ; it != end;++it) {
qDebug() << *it;
}
}© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.