iterator Class

class QTextBlock::iterator

Die Klasse QTextBlock::iterator bietet einen Iterator zum Lesen des Inhalts einer QTextBlock. Mehr...

Öffentliche Funktionen

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

Detaillierte Beschreibung

Ein Block besteht aus einer Folge von Textfragmenten. Diese Klasse bietet eine Möglichkeit, über diese zu iterieren und ihren Inhalt zu lesen. Sie bietet keine Möglichkeit, die interne Struktur oder den Inhalt des Blocks zu verändern.

Ein Iterator kann konstruiert und verwendet werden, um auf die Fragmente innerhalb eines Textblocks auf folgende Weise zuzugreifen:

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

Siehe auch QTextFragment.

Dokumentation der Mitgliedsfunktionen

[constexpr noexcept] iterator::iterator()

Konstruiert einen Iterator für diesen Textblock.

bool iterator::atEnd() const

Gibt true zurück, wenn das aktuelle Element das letzte Element des Textblocks ist.

QTextFragment iterator::fragment() const

Gibt das Textfragment zurück, auf das der Iterator gerade zeigt.

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

Gibt true zurück, wenn sich dieser Iterator vom Iterator other unterscheidet; andernfalls wird false zurückgegeben.

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

Der Präfix-Operator ++ (++i) setzt den Iterator auf das nächste Element im Hash und gibt einen Iterator auf das neue aktuelle Element zurück.

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

Der Postfix-Operator ++ (i++) setzt den Iterator auf das nächste Element im Textblock und gibt einen Iterator auf das alte aktuelle Element zurück.

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

Der Präfix-Operator (--i) macht das vorhergehende Element aktuell und gibt einen Iterator zurück, der auf das neue aktuelle Element zeigt.

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

Der Postfix-Operator (i--) macht das vorangehende Element aktuell und gibt einen Iterator zum alten aktuellen Element zurück.

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

Gibt true zurück, wenn dieser Iterator mit dem Iterator other identisch ist; andernfalls wird false zurückgegeben.

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