QTextBlockGroup 类提供容器为文本块在 QTextDocument . 更多...
头: | #include <QTextBlockGroup> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承: | QTextObject |
继承者: | QTextList |
注意: 此类的所有函数 可重入 .
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 ) |
Block groups can be used to organize blocks of text within a document. They maintain an up-to-date list of the text blocks that belong to them, even when text blocks are being edited.
Each group has a parent document which is specified when the group is constructed.
Text blocks can be inserted into a group with blockInserted (), and removed with blockRemoved (). If a block's format is changed, blockFormatChanged () 被调用。
The list of blocks in the group is returned by blockList (). Note that the blocks in the list are not necessarily adjacent elements in the document; for example, the top-level items in a multi-level list will be separated by the items in lower levels of the list.
另请参阅 QTextBlock and QTextDocument .
[explicit protected]
QTextBlockGroup::
QTextBlockGroup
(
QTextDocument
*
document
)
创建新的新块组为给定 document .
警告: This function should only be called from QTextDocument::createObject ().
[virtual protected]
QTextBlockGroup::
~QTextBlockGroup
()
Destroys this block group; the blocks are not deleted, they simply don't belong to this block anymore.
[virtual protected]
void
QTextBlockGroup::
blockFormatChanged
(const
QTextBlock
&
block
)
This function is called whenever the specified block of text is changed. The text block is a member of this group.
基类实现什么都不做。
[virtual protected]
void
QTextBlockGroup::
blockInserted
(const
QTextBlock
&
block
)
Appends the given block to the end of the group.
警告: If you reimplement this function you must call the base class implementation.
[protected]
QList
<
QTextBlock
> QTextBlockGroup::
blockList
() const
Returns a (possibly empty) list of all the blocks that are part of the block group.
[virtual protected]
void
QTextBlockGroup::
blockRemoved
(const
QTextBlock
&
block
)
移除给定 block from the group; the block itself is not deleted, it simply isn't a member of this group anymore.