QTextObject Class Reference

[ QtGui module]

The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument 在一起。 更多...

继承 QObject .

Inherited by QTextBlockGroup and QTextFrame .

方法


详细描述

The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument 在一起。

The common grouping text objects are lists ( QTextList ), frames ( QTextFrame ), and tables ( QTextTable ). A text object has an associated format () 和 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 QTextDocument.createObject () which acts as a factory method for creating text objects.


方法文档编制

QTextObject.__init__ ( self , QTextDocument   doc )

创建新的 QTextObject 为 given document .

警告: This function should never be called directly, but only from QTextDocument.createObject ().

QTextDocument QTextObject.document ( self )

Returns the document this object belongs to.

另请参阅 format ().

QTextFormat QTextObject.format ( self )

Returns the text object's format.

另请参阅 setFormat () 和 document ().

int QTextObject.formatIndex ( self )

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

另请参阅 QTextDocument.allFormats ().

int QTextObject.objectIndex ( self )

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

QTextObject.setFormat ( self , QTextFormat   format )

Sets the text object's format .

另请参阅 format ().