PySide6.QtGui.QTextBlockGroup¶
- class QTextBlockGroup¶
The
QTextBlockGroup
class provides a container for text blocks within aQTextDocument
. More…Inherited by:
QTextList
Synopsis¶
Methods¶
def
__init__()
def
blockList()
Virtual methods¶
def
blockInserted()
def
blockRemoved()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
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 withblockRemoved()
. If a block’s format is changed,blockFormatChanged()
is called.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.See also
- __init__(doc)¶
- Parameters:
doc –
QTextDocument
Creates a new block group for the given
document
.Warning
This function should only be called from
createObject()
.- blockFormatChanged(block)¶
- Parameters:
block –
QTextBlock
This function is called whenever the specified
block
of text is changed. The text block is a member of this group.The base class implementation does nothing.
- blockInserted(block)¶
- Parameters:
block –
QTextBlock
Appends the given
block
to the end of the group.Warning
If you reimplement this function you must call the base class implementation.
- blockList()¶
- Return type:
.list of QTextBlock
Returns a (possibly empty) list of all the blocks that are part of the block group.
- blockRemoved(block)¶
- Parameters:
block –
QTextBlock
Removes the given
block
from the group; the block itself is not deleted, it simply isn’t a member of this group anymore.