QMetaSequence::Iterable::ConstIterator Class
class QMetaSequence::Iterable::ConstIteratorQMetaSequence::Iterable::ConstIterator permite recorrer un contenedor en un ` QVariant`. Más...
Esta clase se introdujo en Qt 6.11.
Funciones públicas
| QVariant | operator*() const |
| int | operator->() const |
| QVariant | operator[](qsizetype n) const |
Descripción detallada
Un ` QMetaSequence::Iterable::ConstIterator ` solo puede ser creado por una instancia de ` QMetaSequence::Iterable ` y puede utilizarse de forma similar a otros iteradores de estilo STL.
QList<int> intList = {7, 11, 42};
QVariant variant = QVariant::fromValue(intList);
if (variant.canConvert<QVariantList>()) {
QMetaSequence::Iterable iterable = variant.value<QMetaSequence::Iterable>();
// Se puede utilizar el bucle «range-for» de C++11:
for (const QVariant&v: iterable) {
qDebug() << v;
}
// Se pueden utilizar iteradores:
QMetaSequence::Iterable::const_iteratorit = iterable.begin();
const QMetaSequence::Iterable::const_iteratorend = iterable.end();
for ( ; it != end;++it) {
qDebug() << *it;
}
}Documentación de funciones de miembro
QVariant ConstIterator::operator*() const
Devuelve el elemento actual, convertido a un objeto ` QVariant`.
int ConstIterator::operator->() const
Devuelve el elemento actual, convertido a un ` QVariant::ConstPointer`.
QVariant ConstIterator::operator[](qsizetype n) const
Devuelve el elemento situado a una distancia de n respecto al actual, convertido a 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.