QTextObject Class Reference

[QtGui module]

该QTextObject类是为不同类型对象的基类,它可以为一组零件QTextDocument在一起。More…

继承QObject

通过继承QTextBlockGroupQTextFrame

Methods

  • __init__ (self, QTextDocument doc)
  • QTextDocument document (self)
  • QTextFormat format (self)
  • int formatIndex (self)
  • int objectIndex (self)
  • setFormat (self, QTextFormat format)

Detailed Description

该QTextObject类是为不同类型对象的基类,它可以为一组零件QTextDocument在一起。

通用分组文本对象列表(QTextList) ,框架(QTextFrame)和表(QTextTable) 。文本对象都有一个关联的format()和document( ) 。

基本上有两种类型的文本对象:那些被用来与块(块格式),以及那些被用于字符(字符格式) 。第一种是来源于QTextBlockGroup以及从所述第二类QTextFrame

你很少需要直接使用这个类。在创建自定义的文本对象,你还需要重写QTextDocument.createObject(),它作为一个工厂方法来创建文本对象。


Method Documentation

  1. QTextObject.__init__ (self, QTextDocument doc)

创建一个新的QTextObject对于给定的document

Warning:这个函数不应该被直接调用,而只能从QTextDocument.createObject( ) 。

  1. QTextDocument QTextObject.document (self)

[

返回此对象所属的文件。

]($docs-qtextdocument.html)

See also format( ) 。

  1. QTextFormat QTextObject.format (self)

[

返回文本对象的格式。

]($docs-qtextformat.html)

See also setFormat()和document( ) 。

  1. int QTextObject.formatIndex (self)

返回文档的内部格式列表中的对象的格式的索引。

See also QTextDocument.allFormats( ) 。

  1. int QTextObject.objectIndex (self)

返回此对象的对象索引。这可以被一起使用QTextFormat.setObjectIndex( ) 。

  1. QTextObject.setFormat (self, QTextFormat format)

设置文本对象的format

See also format( ) 。