QTextBlockGroup Class
QTextBlockGroup 类为QTextDocument 中的文本块提供了一个容器。
Header: | #include <QTextBlockGroup> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承: | QTextObject |
继承于: |
- 所有成员(包括继承成员)的列表
- QTextBlockGroup 是富文本处理 API 的一部分。
注意:该类中的所有函数都是可重入的。
保护函数
QTextBlockGroup(QTextDocument *document) | |
virtual | ~QTextBlockGroup() |
virtual void | blockFormatChanged(const QTextBlock &block) |
virtual void | blockInserted(const QTextBlock &block) |
QList<QTextBlock> | blockList() const |
virtual void | blockRemoved(const QTextBlock &block) |
详细说明
块组可用于组织文档中的文本块。即使在编辑文本块时,它们也会维护属于它们的文本块的最新列表。
每个组都有一个父文档,该父文档在创建组时就已指定。
文本块可以通过blockInserted() 插入到组中,也可以通过blockRemoved() 删除。如果块的格式发生变化,blockFormatChanged() 将被调用。
blockList() 将返回组中的块列表。请注意,列表中的块并不一定是文档中相邻的元素;例如,多级列表中的顶级项将被列表中较低级别的项分隔开来。
另请参阅 QTextBlock 和QTextDocument 。
成员函数文档
[explicit protected]
QTextBlockGroup::QTextBlockGroup(QTextDocument *document)
为给定的document 创建一个新的块组。
警告: 此函数只能在QTextDocument::createObject() 中调用。
[virtual noexcept protected]
QTextBlockGroup::~QTextBlockGroup()
销毁此区块组;区块不会被删除,只是不再属于此区块。
[virtual protected]
void QTextBlockGroup::blockFormatChanged(const QTextBlock &block)
每当指定的block 文本发生变化时,都会调用该函数。文本块是该组的成员。
基类实现不做任何操作。
[virtual protected]
void QTextBlockGroup::blockInserted(const QTextBlock &block)
将给定的block 追加到组的末尾。
警告: 如果重新实现此函数,必须调用基类的实现。
[protected]
QList<QTextBlock> QTextBlockGroup::blockList() const
返回区块组中所有区块的列表(可能为空)。
[virtual protected]
void QTextBlockGroup::blockRemoved(const QTextBlock &block)
从组中删除给定的block ;区块本身不会被删除,只是不再是该组的成员。
© 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.