本页内容

QTextFrame::iterator Class

class QTextFrame::iterator

迭代器类提供了一个用于读取QTextFrame 内容的迭代器。更多内容...

公共函数

iterator()
bool atEnd() const
QTextBlock currentBlock() const
QTextFrame *currentFrame() const
QTextFrame *parentFrame() const
bool operator!=(const QTextFrame::iterator &other) const
QTextFrame::iterator &operator++()
QTextFrame::iterator operator++(int)
QTextFrame::iterator &operator--()
QTextFrame::iterator operator--(int)
bool operator==(const QTextFrame::iterator &other) const

详细描述

一个框架由任意顺序排列的QTextBlock和子QTextFrame组成。该类提供了一种遍历框架的子对象并读取其内容的方法。它不提供修改框架内容的方法。

成员函数文档

[constexpr noexcept default] iterator::iterator()

构建了一个无效的迭代器。

bool iterator::atEnd() const

如果当前项目是文本框中的最后一个项目,则返回true 。

QTextBlock iterator::currentBlock() const

返回迭代器当前指向的块。如果迭代器指向一个子帧,则返回的块无效。

另请参阅 currentFrame()。

QTextFrame *iterator::currentFrame() const

返回迭代器所指向的当前帧;如果迭代器当前指向一个块,则返回nullptr 。

另请参阅 currentBlock()。

QTextFrame *iterator::parentFrame() const

返回当前帧的父帧。

另请参阅 currentFrame() 和QTextFrame::parentFrame()。

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

如果迭代器与 `other ` 迭代器不同,则返回 `true`;否则返回 `false`。

QTextFrame::iterator &iterator::operator++()

将迭代器移至下一个帧或块。

另请参阅 currentBlock()和currentFrame()。

QTextFrame::iterator iterator::operator++(int)

后缀运算符++ (i++ )将迭代器向前移动到文本框中的下一个项目,并返回指向上一个项目的迭代器。

QTextFrame::iterator &iterator::operator--()

将迭代器移动到上一个帧或块。

另请参阅 currentBlock() 和currentFrame()。

QTextFrame::iterator iterator::operator--(int)

后缀运算符-- (i-- )将当前帧中的前一个元素设为当前元素,并返回指向该旧元素的迭代器。

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

如果该迭代器与other 迭代器相同,则返回true;否则返回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.