QTextObject

The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument together. More

Inheritance diagram of PySide2.QtGui.QTextObject

Inherited by: QTextBlockGroup, QTextFrame, QTextList, QTextTable

Synopsis

Functions

Detailed Description

The common grouping text objects are lists ( QTextList ), frames ( QTextFrame ), and tables ( QTextTable ). A text object has an associated format() and document() .

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 from QTextFrame .

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.

class PySide2.QtGui.QTextObject(doc)

Creates a new QTextObject for the given document .

Warning

This function should never be called directly, but only from createObject() .

PySide2.QtGui.QTextObject.document()
Return type:

PySide2.QtGui.QTextDocument

Returns the document this object belongs to.

See also

format()

PySide2.QtGui.QTextObject.format()
Return type:

PySide2.QtGui.QTextFormat

Returns the text object’s format.

PySide2.QtGui.QTextObject.formatIndex()
Return type:

int

Returns the index of the object’s format in the document’s internal list of formats.

See also

allFormats()

PySide2.QtGui.QTextObject.objectIndex()
Return type:

int

Returns the object index of this object. This can be used together with setObjectIndex() .

PySide2.QtGui.QTextObject.setFormat(format)
Parameters:

formatPySide2.QtGui.QTextFormat

Sets the text object’s format .

See also

format()