En esta página

QTextBlock::iterator Class

class QTextBlock::iterator

La clase QTextBlock::iterator proporciona un iterador para leer el contenido de un QTextBlock. Más...

Funciones públicas

iterator()
bool atEnd() const
QTextFragment fragment() const
bool operator!=(const QTextBlock::iterator &other) const
QTextBlock::iterator &operator++()
QTextBlock::iterator operator++(int)
QTextBlock::iterator &operator--()
QTextBlock::iterator operator--(int)
bool operator==(const QTextBlock::iterator &other) const

Descripción detallada

Un bloque consiste en una secuencia de fragmentos de texto. Esta clase permite iterar sobre ellos y leer su contenido. No permite modificar la estructura interna ni el contenido del bloque.

Se puede construir un iterador y utilizarlo para acceder a los fragmentos de un bloque de texto de la siguiente manera:

    QTextBlock::iterator it;
    for (it = currentBlock.begin(); !(it.atEnd()); ++it) {
        QTextFragment currentFragment = it.fragment();
        if (currentFragment.isValid())
            processFragment(currentFragment);
    }

Véase también QTextFragment.

Documentación de las funciones miembro

[constexpr noexcept] iterator::iterator()

Construye un iterador para este bloque de texto.

bool iterator::atEnd() const

Devuelve true si el elemento actual es el último del bloque de texto.

QTextFragment iterator::fragment() const

Devuelve el fragmento de texto al que apunta actualmente el iterador.

bool iterator::operator!=(const QTextBlock::iterator &other) const

Devuelve true si este iterador es diferente del iterador other; en caso contrario devuelve false.

QTextBlock::iterator &iterator::operator++()

El operador prefijo ++ (++i) avanza el iterador al siguiente elemento del hash y devuelve un iterador al nuevo elemento actual.

QTextBlock::iterator iterator::operator++(int)

El operador postfijo ++ (i++) avanza el iterador al siguiente elemento del bloque de texto y devuelve un iterador al antiguo elemento actual.

QTextBlock::iterator &iterator::operator--()

El operador prefijo - (--i) hace actual el elemento precedente y devuelve un iterador que apunta al nuevo elemento actual.

QTextBlock::iterator iterator::operator--(int)

El operador postfijo - (i--) hace actual el elemento precedente y devuelve un iterador al antiguo elemento actual.

bool iterator::operator==(const QTextBlock::iterator &other) const

Devuelve true si este iterador es el mismo que el iterador other; en caso contrario devuelve false.

© 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.