PySide6.QtGui.QTextObject¶
- class QTextObject¶
The
QTextObjectclass is a base class for different kinds of objects that can group parts of aQTextDocumenttogether.Details
The common grouping text objects are lists (
QTextList), frames (QTextFrame), and tables (QTextTable). A text object has an associatedformat()anddocument().There are essentially two kinds of text objects: those that are used with blocks (block formats), and those that are used with characters (character formats). The first kind are derived from
QTextBlockGroup, and the second kind fromQTextFrame.You rarely need to use this class directly. When creating custom text objects, you will also need to reimplement
createObject()which acts as a factory method for creating text objects.See also
Inherited by:
QTextFrame,QTextTable,QTextBlockGroup,QTextListSynopsis¶
Methods¶
def
__init__()def
document()def
format()def
formatIndex()def
objectIndex()def
setFormat()
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
- __init__(doc)¶
- Parameters:
doc –
QTextDocument
Creates a new
QTextObjectfor the givendocument.Warning
This function should never be called directly, but only from
createObject().- document()¶
- Return type:
Returns the document this object belongs to.
See also
- format()¶
- Return type:
Returns the text object’s format.
See also
- formatIndex()¶
- Return type:
int
Returns the index of the object’s format in the document’s internal list of formats.
See also
- objectIndex()¶
- Return type:
int
Returns the object index of this object. This can be used together with
setObjectIndex().- setFormat(format)¶
- Parameters:
format –
QTextFormat
Sets the text object’s
format.See also