Auf dieser Seite

QTextBlock::iterator Class

class QTextBlock::iterator

Die Klasse „ QTextBlock::iterator “ stellt einen Iterator zum Auslesen des Inhalts einer „ QTextBlock “ bereit. 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

Ausführliche Beschreibung

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

Ein Iterator kann wie folgt erstellt und verwendet werden, um auf die Fragmente innerhalb eines Textblocks 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 default] iterator::iterator()

Erstellt einen Iterator für diesen Textblock.

bool iterator::atEnd() const

Gibt „ true “ zurück, wenn das aktuelle Element das letzte Element im Textblock 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) verschiebt den Iterator zum nächsten Element im Hash und gibt einen Iterator auf das neue aktuelle Element zurück.

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

Der Postfix-Operator „++“ (i++) verschiebt den Iterator zum nächsten Element im Textblock und gibt einen Iterator auf das zuvor aktuelle Element zurück.

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

Der Präfix-Operator (--i) macht das vorangehende Element zum aktuellen Element und gibt einen Iterator zurück, der auf das neue aktuelle Element verweist.

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

Der Postfix-Operator (i--) macht das vorhergehende Element zum aktuellen Element und gibt einen Iterator auf das zuvor aktuelle Element zurück.

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

Gibt „true“ zurück, wenn dieser Iterator mit dem Iterator „ other “ übereinstimmt; andernfalls wird „ false “ zurückgegeben.

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