PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/PyQt-x11-gpl-4.9.4/doc/html/qtextlist.html

#
HTML | 90 lines | 72 code | 18 blank | 0 comment | 0 complexity | 7837f5cbaa280d7ce80ed0c1671abc2b MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  3. <html><head><title>QTextList Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
  4. a:link { color: #004faf; text-decoration: none }
  5. a:visited { color: #672967; text-decoration: none }
  6. td.postheader { font-family: sans-serif }
  7. tr.address { font-family: sans-serif }
  8. body { background: #ffffff; color: black; }
  9. </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="index.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
  10. <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
  11. <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&#160;<i>doc</i>)</li><li><div class="fn" /><b><a href="qtextlist.html#add">add</a></b> (<i>self</i>, QTextBlock&#160;<i>block</i>)</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&#160;<i>i</i>)</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&#160;<i>i</i>)</li><li><div class="fn" /><b><a href="qtextlist.html#setFormat">setFormat</a></b> (<i>self</i>, QTextListFormat&#160;<i>aformat</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" /> <b><a href="qtextlist.html#__len__">__len__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextList class provides a decorated list of items in a
  12. <a href="qtextdocument.html">QTextDocument</a>.</p>
  13. <p>A list contains a sequence of text blocks, each of which is
  14. marked with a bullet point or other symbol. Multiple levels of
  15. lists can be used, and the automatic numbering feature provides
  16. support for ordered numeric and alphabetical lists.</p>
  17. <p>Lists are created by using a text cursor to insert an empty list
  18. at the current position or by moving existing text into a new list.
  19. The <a href="qtextcursor.html#insertList">QTextCursor.insertList</a>()
  20. function inserts an empty block into the document at the cursor
  21. position, and makes it the first item in a list.</p>
  22. <pre class="cpp">
  23. <span class="type"><a href="qtextlistformat.html">QTextListFormat</a></span> listFormat;
  24. <span class="keyword">if</span> (list) {
  25. listFormat <span class="operator">=</span> list<span class="operator">-</span><span class="operator">&gt;</span>format();
  26. listFormat<span class="operator">.</span>setIndent(listFormat<span class="operator">.</span>indent() <span class="operator">+</span> <span class="number">1</span>);
  27. }
  28. listFormat<span class="operator">.</span>setStyle(<span class="type"><a href="qtextlistformat.html">QTextListFormat</a></span><span class="operator">.</span>ListDisc);
  29. cursor<span class="operator">.</span>insertList(listFormat);
  30. </pre>
  31. <p>The <a href="qtextcursor.html#createList">QTextCursor.createList</a>()
  32. function takes the contents of the cursor's current block and turns
  33. it into the first item of a new list.</p>
  34. <p>The cursor's current list is found with <a href="qtextcursor.html#currentList">QTextCursor.currentList</a>().</p>
  35. <p>The number of items in a list is given by <a href="qtextlist.html#count">count</a>(). Each item can be obtained by
  36. its index in the list with the <a href="qtextlist.html#item">item</a>() function. Similarly, the index of
  37. a given item can be found with <a href="qtextlist.html#itemNumber">itemNumber</a>(). The text of each item
  38. can be found with the <a href="qtextlist.html#itemText">itemText</a>() function.</p>
  39. <p>Note that the items in the list may not be adjacent elements in
  40. the document. For example, the top-level items in a multi-level
  41. list will be separated by the items in lower levels of the
  42. list.</p>
  43. <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
  44. the list.</p>
  45. <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
  46. decoration of the list itself, and not the individual items.</p>
  47. <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextList" />QTextList.__init__ (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a>&#160;<i>doc</i>)</h3><h3 class="fn"><a name="add" />QTextList.add (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>block</i>)</h3><p>Makes the given <i>block</i> part of the list.</p>
  48. <p><b>See also</b> <a href="qtextlist.html#remove">remove</a>() and
  49. <a href="qtextlist.html#removeItem">removeItem</a>().</p>
  50. <h3 class="fn"><a name="count" />int QTextList.count (<i>self</i>)</h3><p>Returns the number of items in the list.</p>
  51. <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>
  52. <p><b>See also</b> <a href="qtextlist.html#setFormat">setFormat</a>().</p>
  53. <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&#160;<i>i</i>)</h3><p>Returns the <i>i</i>-th text block in the list.</p>
  54. <p><b>See also</b> <a href="qtextlist.html#count">count</a>() and
  55. <a href="qtextlist.html#itemText">itemText</a>().</p>
  56. <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
  57. <i>block</i>. Returns -1 if the block was not present in the
  58. list.</p>
  59. <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
  60. <i>block</i>.</p>
  61. <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>
  62. <p><b>See also</b> <a href="qtextlist.html#add">add</a>() and
  63. <a href="qtextlist.html#removeItem">removeItem</a>().</p>
  64. <h3 class="fn"><a name="removeItem" />QTextList.removeItem (<i>self</i>, int&#160;<i>i</i>)</h3><p>Removes the item at item position <i>i</i> from the list. When
  65. the last item in the list is removed, the list is automatically
  66. deleted by the <a href="qtextdocument.html">QTextDocument</a> that
  67. owns it.</p>
  68. <p><b>See also</b> <a href="qtextlist.html#add">add</a>() and
  69. <a href="qtextlist.html#remove">remove</a>().</p>
  70. <h3 class="fn"><a name="setFormat" />QTextList.setFormat (<i>self</i>, <a href="qtextlistformat.html">QTextListFormat</a>&#160;<i>aformat</i>)</h3><p>Sets the list's format to <i>format</i>.</p>
  71. <p><b>See also</b> <a href="qtextlist.html#format">format</a>().</p>
  72. <h3 class="fn"><a name="__len__" /> QTextList.__len__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.4 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> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>