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のrange-forが使用可能:
for(constQVariant&v: iterable) {
qDebug() << v;
}
// イテレータを使用できます:
QMetaSequence::Iterable::const_iteratorit=iterable.begin();
constQMetaSequence::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.