File: qtextlist.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (51 lines) | stat: -rw-r--r-- 8,370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTextList Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextList Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextList class provides a decorated list of items in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
<p>Inherits <a href="qtextblockgroup.html">QTextBlockGroup</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextlist.html#QTextList">__init__</a></b> (<i>self</i>, QTextDocument)</li><li><div class="fn" /><b><a href="qtextlist.html#add">add</a></b> (<i>self</i>, QTextBlock)</li><li><div class="fn" />int <b><a href="qtextlist.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />QTextListFormat <b><a href="qtextlist.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextlist.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />QTextBlock <b><a href="qtextlist.html#item">item</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qtextlist.html#itemNumber">itemNumber</a></b> (<i>self</i>, QTextBlock)</li><li><div class="fn" />QString <b><a href="qtextlist.html#itemText">itemText</a></b> (<i>self</i>, QTextBlock)</li><li><div class="fn" /><b><a href="qtextlist.html#remove">remove</a></b> (<i>self</i>, QTextBlock)</li><li><div class="fn" /><b><a href="qtextlist.html#removeItem">removeItem</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qtextlist.html#setFormat">setFormat</a></b> (<i>self</i>, QTextListFormat)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextList class provides a decorated list of items in a <a href="qtextdocument.html">QTextDocument</a>.</p>
<p>A list contains a sequence of text blocks, each of which is marked with a bullet point or other symbol. Multiple levels of lists can be used, and the automatic numbering feature provides support for ordered numeric and alphabetical lists.</p>
<p>Lists are created by using a text cursor to insert an empty list at the current position or by moving existing text into a new list. The <a href="qtextcursor.html#insertList">QTextCursor.insertList</a>() function inserts an empty block into the document at the cursor position, and makes it the first item in a list.</p>
<pre>     QTextListFormat listFormat;
     if (list) {
         listFormat = list-&gt;format();
         listFormat.setIndent(listFormat.indent() + 1);
     }

     listFormat.setStyle(QTextListFormat.ListDisc);
     cursor.insertList(listFormat);</pre>
<p>The <a href="qtextcursor.html#createList">QTextCursor.createList</a>() function takes the contents of the cursor's current block and turns it into the first item of a new list.</p>
<p>The cursor's current list is found with <a href="qtextcursor.html#currentList">QTextCursor.currentList</a>().</p>
<p>The number of items in a list is given by <a href="qtextlist.html#count">count</a>(). Each item can be obtained by its index in the list with the <a href="qtextlist.html#item">item</a>() function. Similarly, the index of a given item can be found with <a href="qtextlist.html#itemNumber">itemNumber</a>(). The text of each item can be found with the <a href="qtextlist.html#itemText">itemText</a>() function.</p>
<p>Note that the items in the list may not be adjacent elements in the document. For example, the top-level items in a multi-level list will be separated by the items in lower levels of the list.</p>
<p>List items can be deleted by index with the <a href="qtextlist.html#removeItem">removeItem</a>() function. <a href="qtextlist.html#remove">remove</a>() deletes the specified item in the list.</p>
<p>The list's format is set with <a href="qtextlist.html#setFormat">setFormat</a>() and read with <a href="qtextlist.html#format">format</a>(). The format describes the decoration of the list itself, and not the individual items.</p>
<p>See also <a href="qtextblock.html">QTextBlock</a>, <a href="qtextlistformat.html">QTextListFormat</a>, and <a href="qtextcursor.html">QTextCursor</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextList" />QTextList.__init__ (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a>)</h3><h3 class="fn"><a name="add" />QTextList.add (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>)</h3><p>Makes the given <i>block</i> part of the list.</p>
<p>See also <a href="qtextlist.html#remove">remove</a>() and <a href="qtextlist.html#removeItem">removeItem</a>().</p>
<a name="//apple_ref/cpp/instm/QTextList/count" />
<h3 class="fn"><a name="count" />int QTextList.count (<i>self</i>)</h3><p>Returns the number of items in the list.</p>
<a name="//apple_ref/cpp/instm/QTextList/format" />
<h3 class="fn"><a name="format" /><a href="qtextlistformat.html">QTextListFormat</a> QTextList.format (<i>self</i>)</h3><p>Returns the list's format.</p>
<p>See also <a href="qtextlist.html#setFormat">setFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QTextList/item" />
<h3 class="fn"><a name="isEmpty" />bool QTextList.isEmpty (<i>self</i>)</h3><h3 class="fn"><a name="item" /><a href="qtextblock.html">QTextBlock</a> QTextList.item (<i>self</i>, int)</h3><p>Returns the <i>i</i>-th text block in the list.</p>
<p>See also <a href="qtextlist.html#count">count</a>() and <a href="qtextlist.html#itemText">itemText</a>().</p>
<a name="//apple_ref/cpp/instm/QTextList/itemNumber" />
<h3 class="fn"><a name="itemNumber" />int QTextList.itemNumber (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>)</h3><p>Returns the index of the list item that corresponds to the given <i>block</i>. Returns -1 if the block was not present in the list.</p>
<a name="//apple_ref/cpp/instm/QTextList/itemText" />
<h3 class="fn"><a name="itemText" />QString QTextList.itemText (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>)</h3><p>Returns the text of the list item that corresponds to the given <i>block</i>.</p>
<a name="//apple_ref/cpp/instm/QTextList/remove" />
<h3 class="fn"><a name="remove" />QTextList.remove (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>)</h3><p>Removes the given <i>block</i> from the list.</p>
<p>See also <a href="qtextlist.html#add">add</a>() and <a href="qtextlist.html#removeItem">removeItem</a>().</p>
<a name="//apple_ref/cpp/instm/QTextList/removeItem" />
<h3 class="fn"><a name="removeItem" />QTextList.removeItem (<i>self</i>, int)</h3><p>Removes the item at item position <i>i</i> from the list. When the last item in the list is removed, the list is automatically deleted by the <a href="qtextdocument.html">QTextDocument</a> that owns it.</p>
<p>See also <a href="qtextlist.html#add">add</a>() and <a href="qtextlist.html#remove">remove</a>().</p>
<a name="//apple_ref/cpp/instm/QTextList/setFormat" />
<h3 class="fn"><a name="setFormat" />QTextList.setFormat (<i>self</i>, <a href="qtextlistformat.html">QTextListFormat</a>)</h3><p>Sets the list's format to <i>format</i>.</p>
<p>See also <a href="qtextlist.html#format">format</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>