QMetaSequence::Iterable::ConstIterator Class
class QMetaSequence::Iterable::ConstIteratorQMetaSequence::Iterable::ConstIterator consente di eseguire un'iterazione su un contenitore in un ciclo " QVariant". Altro...
Questa classe è stata introdotta in Qt 6.11.
Funzioni pubbliche
| QVariant | operator*() const |
| int | operator->() const |
| QVariant | operator[](qsizetype n) const |
Descrizione dettagliata
Un oggetto ` QMetaSequence::Iterable::ConstIterator ` può essere creato solo da un'istanza di ` QMetaSequence::Iterable ` e può essere utilizzato in modo simile agli altri iteratori in stile STL.
QList<int> intList = {7, 11, 42};
QVariant variant = QVariant::fromValue(intList);
if (variant.canConvert<QVariantList>()) {
QMetaSequence::Iterable iterable = variant.value<QMetaSequence::Iterable>();
// È possibile utilizzare il ciclo range-for di C++11:
for (const QVariant&v: iterable) {
qDebug() << v;
}
// È possibile utilizzare gli iteratori:
QMetaSequence::Iterable::const_iteratorit = iterable.begin();
const QMetaSequence::Iterable::const_iteratorend = iterable.end();
for ( ; it != end;++it) {
qDebug() << *it;
}
}Documentazione delle funzioni membro
QVariant ConstIterator::operator*() const
Restituisce l'elemento corrente, convertito in un oggetto ` QVariant`.
int ConstIterator::operator->() const
Restituisce l'elemento corrente, convertito in un oggetto ` QVariant::ConstPointer`.
QVariant ConstIterator::operator[](qsizetype n) const
Restituisce l'offset dell'elemento rispetto a quello corrente, calcolato come n, convertito in un QVariant.
© 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.