1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/text/qtextlist.cpp -->
7
<title>Qt 4.0: QTextList Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QTextList Class Reference</h1>
21
<p>The QTextList class provides a decorated list of items in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
22
<pre>#include <QTextList></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
23
<p>Inherits <a href="qtextblockgroup.html">QTextBlockGroup</a>.</p>
25
<li><a href="qtextlist-members.html">List of all members, including inherited members</a></li>
27
<a name="public-functions"></a>
28
<h3>Public Functions</h3>
30
<li><div class="fn"/>void <b><a href="qtextlist.html#add">add</a></b> ( const QTextBlock & <i>block</i> )</li>
31
<li><div class="fn"/>int <b><a href="qtextlist.html#count">count</a></b> () const</li>
32
<li><div class="fn"/>QTextListFormat <b><a href="qtextlist.html#format">format</a></b> () const</li>
33
<li><div class="fn"/>bool <b><a href="qtextlist.html#isEmpty">isEmpty</a></b> () const</li>
34
<li><div class="fn"/>QTextBlock <b><a href="qtextlist.html#item">item</a></b> ( int <i>i</i> ) const</li>
35
<li><div class="fn"/>int <b><a href="qtextlist.html#itemNumber">itemNumber</a></b> ( const QTextBlock & <i>block</i> ) const</li>
36
<li><div class="fn"/>QString <b><a href="qtextlist.html#itemText">itemText</a></b> ( const QTextBlock & <i>block</i> ) const</li>
37
<li><div class="fn"/>void <b><a href="qtextlist.html#remove">remove</a></b> ( const QTextBlock & <i>block</i> )</li>
38
<li><div class="fn"/>void <b><a href="qtextlist.html#removeItem">removeItem</a></b> ( int <i>i</i> )</li>
39
<li><div class="fn"/>void <b><a href="qtextlist.html#setFormat">setFormat</a></b> ( const QTextListFormat & <i>format</i> )</li>
42
<li><div class="fn"/>4 public functions inherited from <a href="qtextobject.html#public-functions">QTextObject</a></li>
43
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
45
<h3>Additional Inherited Members</h3>
47
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
48
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
49
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
50
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
51
<li><div class="fn"/>4 protected functions inherited from <a href="qtextblockgroup.html#protected-functions">QTextBlockGroup</a></li>
52
<li><div class="fn"/>1 protected function inherited from <a href="qtextobject.html#protected-functions">QTextObject</a></li>
53
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
55
<a name="details"></a>
57
<h2>Detailed Description</h2>
58
<p>The QTextList class provides a decorated list of items in a <a href="qtextdocument.html">QTextDocument</a>.</p>
59
<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>
60
<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>
61
<pre> QTextListFormat listFormat;
63
listFormat = list->format();
64
listFormat.setIndent(listFormat.indent() + 1);
67
listFormat.setStyle(QTextListFormat::ListDisc);
68
cursor.insertList(listFormat);</pre>
69
<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>
70
<p>The cursor's current list is found with <a href="qtextcursor.html#currentList">QTextCursor::currentList</a>().</p>
71
<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>
72
<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>
73
<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>
74
<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>
75
<p>See also <a href="qtextlistformat.html">QTextListFormat</a> and <a href="qtextcursor.html">QTextCursor</a>.</p>
77
<h2>Member Function Documentation</h2>
78
<h3 class="fn"><a name="add"></a>void QTextList::add ( const <a href="qtextblock.html">QTextBlock</a> & <i>block</i> )</h3>
79
<p>Makes the given <i>block</i> part of the list.</p>
80
<h3 class="fn"><a name="count"></a>int QTextList::count () const</h3>
81
<p>Returns the number of items in the list.</p>
82
<p>See also <a href="qtextlist.html#isEmpty">isEmpty</a>().</p>
83
<h3 class="fn"><a name="format"></a><a href="qtextlistformat.html">QTextListFormat</a> QTextList::format () const</h3>
84
<p>Returns the list's format.</p>
85
<h3 class="fn"><a name="isEmpty"></a>bool QTextList::isEmpty () const</h3>
86
<p>Returns true if the list has no items; otherwise returns false.</p>
87
<p>See also <a href="qtextlist.html#count">count</a>().</p>
88
<h3 class="fn"><a name="item"></a><a href="qtextblock.html">QTextBlock</a> QTextList::item ( int <i>i</i> ) const</h3>
89
<p>Returns the <i>i</i>-th text block in the list.</p>
90
<p>See also <a href="qtextlist.html#count">count</a>() and <a href="qtextlist.html#itemText">itemText</a>().</p>
91
<h3 class="fn"><a name="itemNumber"></a>int QTextList::itemNumber ( const <a href="qtextblock.html">QTextBlock</a> & <i>block</i> ) const</h3>
92
<p>Returns the index of the list item that corresponds to the given <i>block</i>.</p>
93
<h3 class="fn"><a name="itemText"></a><a href="qstring.html">QString</a> QTextList::itemText ( const <a href="qtextblock.html">QTextBlock</a> & <i>block</i> ) const</h3>
94
<p>Returns the text of the list item that corresponds to the given <i>block</i>.</p>
95
<h3 class="fn"><a name="remove"></a>void QTextList::remove ( const <a href="qtextblock.html">QTextBlock</a> & <i>block</i> )</h3>
96
<p>Removes the given <i>block</i> from the list.</p>
97
<h3 class="fn"><a name="removeItem"></a>void QTextList::removeItem ( int <i>i</i> )</h3>
98
<p>Removes the item at item position <i>i</i> from the list.</p>
99
<h3 class="fn"><a name="setFormat"></a>void QTextList::setFormat ( const <a href="qtextlistformat.html">QTextListFormat</a> & <i>format</i> )</h3>
100
<p>Sets the list's format to <i>format</i>.</p>
101
<p /><address><hr /><div align="center">
102
<table width="100%" cellspacing="0" border="0"><tr class="address">
103
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
104
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
105
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
106
</tr></table></div></address></body>