QTextList Class Reference

[QtGui module]

该QTextList类提供了在一个项目的装修清单QTextDocumentMore…

继承QTextBlockGroup

Methods

  • __init__ (self, QTextDocument doc)
  • add (self, QTextBlock block)
  • int count (self)
  • QTextListFormat format (self)
  • bool isEmpty (self)
  • QTextBlock item (self, int i)
  • int itemNumber (self, QTextBlock)
  • QString itemText (self, QTextBlock)
  • remove (self, QTextBlock)
  • removeItem (self, int i)
  • setFormat (self, QTextListFormat aformat)

Special Methods

  • __len__ (self)

Detailed Description

该QTextList类提供了在一个项目的装修清单QTextDocument

列表中包含的序列的文本块,其中的每一个标有符号点或其他符号。列出的多个层面都可以使用,并自动编号功能提供了有序的数字和字母顺序列出了支持。

列表是通过使用文本光标插入一个空列表在当前位置或移动现有文本转换成一个新的列表创建。该QTextCursor.insertList( )函数插入光标所在位置的空块插入到文档中,并使其在列表中的第一个项目。

  1. [QTextListFormat]($docs-qtextlistformat.html) listFormat;
  2. if (list) {
  3. listFormat = list->format();
  4. listFormat.setIndent(listFormat.indent() + 1);
  5. }
  6. listFormat.setStyle([QTextListFormat]($docs-qtextlistformat.html).ListDisc);
  7. cursor.insertList(listFormat);

QTextCursor.createList( )函数将光标的当前块的内容,并把它变成一个新的列表中的第一项。

光标的当前列表中找到与QTextCursor.currentList( ) 。

列表中的项目的数目由下式给出count( ) 。每个项目都可以通过其索引中的列表中获得item()函数。类似地,给定的项的索引可以找到itemNumber( ) 。每个项的文本可以与被发现itemText()函数。

请注意,列表中的项目可能无法在文件中相邻元素。例如,在一个多级列表中的顶级项目将由项目列表中较低水平的分离。

列表项可以通过索引与删除removeItem()函数。remove( )删除指定项在列表中。

该列表的格式设置与setFormat()和read与format( ) 。该格式描述列表本身的装饰,而不是单个项目。


Method Documentation

  1. QTextList.__init__ (self, QTextDocument doc)
  1. QTextList.add (self, QTextBlock block)

使给定的block列表的一部分。

See also remove()和removeItem( ) 。

  1. int QTextList.count (self)

返回的项目的列表中的号码。

  1. QTextListFormat QTextList.format (self)

[

返回列表的格式。

]($docs-qtextlistformat.html)

See also setFormat( ) 。

  1. bool QTextList.isEmpty (self)
  1. QTextBlock QTextList.item (self, int i)

[

返回i列表中的第文本块。

]($docs-qtextblock.html)

See also count()和itemText( ) 。

  1. int QTextList.itemNumber (self, QTextBlock)

返回对应于给定列表项的索引block。返回-1,如果块没有出现在清单中。

  1. QString QTextList.itemText (self, QTextBlock)

返回对应于给定列表项的文本block

  1. QTextList.remove (self, QTextBlock)

删除给定的block从列表中。

See also add()和removeItem( ) 。

  1. QTextList.removeItem (self, int i)

在删除项目位置的项目i从列表中。当在列表中的最后一个项目被删除,该列表是由自动删除QTextDocument拥有它。

See also add()和remove( ) 。

  1. QTextList.setFormat (self, QTextListFormat aformat)

设置列表的格式format

See also format( ) 。

  1. QTextList.__len__ (self)