| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlistview.cpp:7335 -->
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|---|
| 6 | <title>QListViewItemIterator Class</title>
|
|---|
| 7 | <style type="text/css"><!--
|
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
|---|
| 11 | body { background: #ffffff; color: black; }
|
|---|
| 12 | --></style>
|
|---|
| 13 | </head>
|
|---|
| 14 | <body>
|
|---|
| 15 |
|
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|---|
| 17 | <tr bgcolor="#E5E5E5">
|
|---|
| 18 | <td valign=center>
|
|---|
| 19 | <a href="index.html">
|
|---|
| 20 | <font color="#004faf">Home</font></a>
|
|---|
| 21 | | <a href="classes.html">
|
|---|
| 22 | <font color="#004faf">All Classes</font></a>
|
|---|
| 23 | | <a href="mainclasses.html">
|
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
|---|
| 25 | | <a href="annotated.html">
|
|---|
| 26 | <font color="#004faf">Annotated</font></a>
|
|---|
| 27 | | <a href="groups.html">
|
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
|---|
| 29 | | <a href="functions.html">
|
|---|
| 30 | <font color="#004faf">Functions</font></a>
|
|---|
| 31 | </td>
|
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListViewItemIterator Class Reference</h1>
|
|---|
| 33 |
|
|---|
| 34 | <p>The QListViewItemIterator class provides an iterator for collections of QListViewItems.
|
|---|
| 35 | <a href="#details">More...</a>
|
|---|
| 36 | <p><tt>#include <<a href="qlistview-h.html">qlistview.h</a>></tt>
|
|---|
| 37 | <p><a href="qlistviewitemiterator-members.html">List of all member functions.</a>
|
|---|
| 38 | <h2>Public Members</h2>
|
|---|
| 39 | <ul>
|
|---|
| 40 | <li class=fn>enum <a href="#IteratorFlag-enum"><b>IteratorFlag</b></a> { Visible = 0x00000001, Invisible = 0x00000002, Selected = 0x00000004, Unselected = 0x00000008, Selectable = 0x00000010, NotSelectable = 0x00000020, DragEnabled = 0x00000040, DragDisabled = 0x00000080, DropEnabled = 0x00000100, DropDisabled = 0x00000200, Expandable = 0x00000400, NotExpandable = 0x00000800, Checked = 0x00001000, NotChecked = 0x00002000 }</li>
|
|---|
| 41 | <li class=fn><a href="#QListViewItemIterator"><b>QListViewItemIterator</b></a> ()</li>
|
|---|
| 42 | <li class=fn><a href="#QListViewItemIterator-2"><b>QListViewItemIterator</b></a> ( QListViewItem * item )</li>
|
|---|
| 43 | <li class=fn><a href="#QListViewItemIterator-3"><b>QListViewItemIterator</b></a> ( QListViewItem * item, int iteratorFlags )</li>
|
|---|
| 44 | <li class=fn><a href="#QListViewItemIterator-4"><b>QListViewItemIterator</b></a> ( const QListViewItemIterator & it )</li>
|
|---|
| 45 | <li class=fn><a href="#QListViewItemIterator-5"><b>QListViewItemIterator</b></a> ( QListView * lv )</li>
|
|---|
| 46 | <li class=fn><a href="#QListViewItemIterator-6"><b>QListViewItemIterator</b></a> ( QListView * lv, int iteratorFlags )</li>
|
|---|
| 47 | <li class=fn>QListViewItemIterator & <a href="#operator-eq"><b>operator=</b></a> ( const QListViewItemIterator & it )</li>
|
|---|
| 48 | <li class=fn><a href="#~QListViewItemIterator"><b>~QListViewItemIterator</b></a> ()</li>
|
|---|
| 49 | <li class=fn>QListViewItemIterator & <a href="#operator++"><b>operator++</b></a> ()</li>
|
|---|
| 50 | <li class=fn>const QListViewItemIterator <a href="#operator++-2"><b>operator++</b></a> ( int )</li>
|
|---|
| 51 | <li class=fn>QListViewItemIterator & <a href="#operator+-eq"><b>operator+=</b></a> ( int j )</li>
|
|---|
| 52 | <li class=fn>QListViewItemIterator & <a href="#operator--"><b>operator--</b></a> ()</li>
|
|---|
| 53 | <li class=fn>const QListViewItemIterator <a href="#operator---2"><b>operator--</b></a> ( int )</li>
|
|---|
| 54 | <li class=fn>QListViewItemIterator & <a href="#operator--eq"><b>operator-=</b></a> ( int j )</li>
|
|---|
| 55 | <li class=fn>QListViewItem * <a href="#operator*"><b>operator*</b></a> ()</li>
|
|---|
| 56 | <li class=fn>QListViewItem * <a href="#current"><b>current</b></a> () const</li>
|
|---|
| 57 | </ul>
|
|---|
| 58 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | The QListViewItemIterator class provides an iterator for collections of QListViewItems.
|
|---|
| 62 | <p>
|
|---|
| 63 | <p> Construct an instance of a QListViewItemIterator, with either a
|
|---|
| 64 | <a href="qlistview.html">QListView</a>* or a <a href="qlistviewitem.html">QListViewItem</a>* as argument, to operate on the tree
|
|---|
| 65 | of QListViewItems, starting from the argument.
|
|---|
| 66 | <p> A QListViewItemIterator iterates over all the items from its
|
|---|
| 67 | starting point. This means that it always makes the first child of
|
|---|
| 68 | the current item the new current item. If there is no child, the
|
|---|
| 69 | next sibling becomes the new current item; and if there is no next
|
|---|
| 70 | sibling, the next sibling of the parent becomes current.
|
|---|
| 71 | <p> The following example creates a list of all the items that have
|
|---|
| 72 | been selected by the user, storing pointers to the items in a
|
|---|
| 73 | QPtrList:
|
|---|
| 74 | <pre>
|
|---|
| 75 | <a href="qptrlist.html">QPtrList</a><QListViewItem> lst;
|
|---|
| 76 | QListViewItemIterator it( myListView );
|
|---|
| 77 | while ( it.<a href="#current">current</a>() ) {
|
|---|
| 78 | if ( it.<a href="#current">current</a>()->isSelected() )
|
|---|
| 79 | lst.<a href="qptrlist.html#append">append</a>( it.<a href="#current">current</a>() );
|
|---|
| 80 | ++it;
|
|---|
| 81 | }
|
|---|
| 82 | </pre>
|
|---|
| 83 |
|
|---|
| 84 | <p> An alternative approach is to use an <a href="#IteratorFlag-enum">IteratorFlag</a>:
|
|---|
| 85 | <pre>
|
|---|
| 86 | <a href="qptrlist.html">QPtrList</a><QListViewItem> lst;
|
|---|
| 87 | QListViewItemIterator it( myListView, QListViewItemIterator::<a href="#IteratorFlag-enum">Selected</a> );
|
|---|
| 88 | while ( it.<a href="#current">current</a>() ) {
|
|---|
| 89 | lst.<a href="qptrlist.html#append">append</a>( it.<a href="#current">current</a>() );
|
|---|
| 90 | ++it;
|
|---|
| 91 | }
|
|---|
| 92 | </pre>
|
|---|
| 93 |
|
|---|
| 94 | <p> A QListViewItemIterator provides a convenient and easy way to
|
|---|
| 95 | traverse a hierarchical <a href="qlistview.html">QListView</a>.
|
|---|
| 96 | <p> Multiple QListViewItemIterators can operate on the tree of
|
|---|
| 97 | QListViewItems. A QListView knows about all iterators operating on
|
|---|
| 98 | its QListViewItems. So when a <a href="qlistviewitem.html">QListViewItem</a> gets removed all
|
|---|
| 99 | iterators that point to this item are updated and point to the
|
|---|
| 100 | following item if possible, otherwise to a valid item before the
|
|---|
| 101 | current one or to 0. Note however that deleting the parent item of
|
|---|
| 102 | an item that an iterator points to is not safe.
|
|---|
| 103 | <p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qlistviewitem.html">QListViewItem</a>, and <a href="advanced.html">Advanced Widgets</a>.
|
|---|
| 104 |
|
|---|
| 105 | <hr><h2>Member Type Documentation</h2>
|
|---|
| 106 | <h3 class=fn><a name="IteratorFlag-enum"></a>QListViewItemIterator::IteratorFlag</h3>
|
|---|
| 107 |
|
|---|
| 108 | <p> These flags can be passed to a QListViewItemIterator constructor
|
|---|
| 109 | (OR-ed together if more than one is used), so that the iterator
|
|---|
| 110 | will only iterate over items that match the given flags.
|
|---|
| 111 | <ul>
|
|---|
| 112 | <li><tt>QListViewItemIterator::Visible</tt>
|
|---|
| 113 | <li><tt>QListViewItemIterator::Invisible</tt>
|
|---|
| 114 | <li><tt>QListViewItemIterator::Selected</tt>
|
|---|
| 115 | <li><tt>QListViewItemIterator::Unselected</tt>
|
|---|
| 116 | <li><tt>QListViewItemIterator::Selectable</tt>
|
|---|
| 117 | <li><tt>QListViewItemIterator::NotSelectable</tt>
|
|---|
| 118 | <li><tt>QListViewItemIterator::DragEnabled</tt>
|
|---|
| 119 | <li><tt>QListViewItemIterator::DragDisabled</tt>
|
|---|
| 120 | <li><tt>QListViewItemIterator::DropEnabled</tt>
|
|---|
| 121 | <li><tt>QListViewItemIterator::DropDisabled</tt>
|
|---|
| 122 | <li><tt>QListViewItemIterator::Expandable</tt>
|
|---|
| 123 | <li><tt>QListViewItemIterator::NotExpandable</tt>
|
|---|
| 124 | <li><tt>QListViewItemIterator::Checked</tt>
|
|---|
| 125 | <li><tt>QListViewItemIterator::NotChecked</tt>
|
|---|
| 126 | </ul>
|
|---|
| 127 | <hr><h2>Member Function Documentation</h2>
|
|---|
| 128 | <h3 class=fn><a name="QListViewItemIterator"></a>QListViewItemIterator::QListViewItemIterator ()
|
|---|
| 129 | </h3>
|
|---|
| 130 | Constructs an empty iterator.
|
|---|
| 131 |
|
|---|
| 132 | <h3 class=fn><a name="QListViewItemIterator-2"></a>QListViewItemIterator::QListViewItemIterator ( <a href="qlistviewitem.html">QListViewItem</a> * item )
|
|---|
| 133 | </h3>
|
|---|
| 134 | Constructs an iterator for the <a href="qlistview.html">QListView</a> that contains the <em>item</em>. The current iterator item is set to point to the <em>item</em>.
|
|---|
| 135 |
|
|---|
| 136 | <h3 class=fn><a name="QListViewItemIterator-3"></a>QListViewItemIterator::QListViewItemIterator ( <a href="qlistviewitem.html">QListViewItem</a> * item, int iteratorFlags )
|
|---|
| 137 | </h3>
|
|---|
| 138 | Constructs an iterator for the <a href="qlistview.html">QListView</a> that contains the <em>item</em>
|
|---|
| 139 | using the flags <em>iteratorFlags</em>. The current iterator item is set
|
|---|
| 140 | to point to <em>item</em> or the next matching item if <em>item</em> doesn't
|
|---|
| 141 | match the flags.
|
|---|
| 142 | <p> <p>See also <a href="#IteratorFlag-enum">QListViewItemIterator::IteratorFlag</a>.
|
|---|
| 143 |
|
|---|
| 144 | <h3 class=fn><a name="QListViewItemIterator-4"></a>QListViewItemIterator::QListViewItemIterator ( const <a href="qlistviewitemiterator.html">QListViewItemIterator</a> & it )
|
|---|
| 145 | </h3>
|
|---|
| 146 | Constructs an iterator for the same <a href="qlistview.html">QListView</a> as <em>it</em>. The
|
|---|
| 147 | current iterator item is set to point on the current item of <em>it</em>.
|
|---|
| 148 |
|
|---|
| 149 | <h3 class=fn><a name="QListViewItemIterator-5"></a>QListViewItemIterator::QListViewItemIterator ( <a href="qlistview.html">QListView</a> * lv )
|
|---|
| 150 | </h3>
|
|---|
| 151 | Constructs an iterator for the <a href="qlistview.html">QListView</a> <em>lv</em>. The current
|
|---|
| 152 | iterator item is set to point on the first child (<a href="qlistviewitem.html">QListViewItem</a>)
|
|---|
| 153 | of <em>lv</em>.
|
|---|
| 154 |
|
|---|
| 155 | <h3 class=fn><a name="QListViewItemIterator-6"></a>QListViewItemIterator::QListViewItemIterator ( <a href="qlistview.html">QListView</a> * lv, int iteratorFlags )
|
|---|
| 156 | </h3>
|
|---|
| 157 | Constructs an iterator for the <a href="qlistview.html">QListView</a> <em>lv</em> with the flags <em>iteratorFlags</em>. The current iterator item is set to point on the
|
|---|
| 158 | first child (<a href="qlistviewitem.html">QListViewItem</a>) of <em>lv</em> that matches the flags.
|
|---|
| 159 | <p> <p>See also <a href="#IteratorFlag-enum">QListViewItemIterator::IteratorFlag</a>.
|
|---|
| 160 |
|
|---|
| 161 | <h3 class=fn><a name="~QListViewItemIterator"></a>QListViewItemIterator::~QListViewItemIterator ()
|
|---|
| 162 | </h3>
|
|---|
| 163 | Destroys the iterator.
|
|---|
| 164 |
|
|---|
| 165 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="current"></a>QListViewItemIterator::current () const
|
|---|
| 166 | </h3>
|
|---|
| 167 | Returns iterator's current item.
|
|---|
| 168 |
|
|---|
| 169 | <p>Examples: <a href="addressbook-example.html#x597">addressbook/centralwidget.cpp</a>, <a href="checklists-example.html#x432">checklists/checklists.cpp</a>, and <a href="dirview-example.html#x1694">dirview/dirview.cpp</a>.
|
|---|
| 170 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="operator*"></a>QListViewItemIterator::operator* ()
|
|---|
| 171 | </h3>
|
|---|
| 172 | Dereference operator. Returns a reference to the current item. The
|
|---|
| 173 | same as <a href="#current">current</a>().
|
|---|
| 174 |
|
|---|
| 175 | <h3 class=fn><a href="qlistviewitemiterator.html">QListViewItemIterator</a> & <a name="operator++"></a>QListViewItemIterator::operator++ ()
|
|---|
| 176 | </h3>
|
|---|
| 177 | Prefix ++. Makes the next item the new current item and returns
|
|---|
| 178 | it. Returns 0 if the current item is the last item or the
|
|---|
| 179 | <a href="qlistview.html">QListView</a> is 0.
|
|---|
| 180 |
|
|---|
| 181 | <h3 class=fn>const <a href="qlistviewitemiterator.html">QListViewItemIterator</a> <a name="operator++-2"></a>QListViewItemIterator::operator++ ( int )
|
|---|
| 182 | </h3>
|
|---|
| 183 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|---|
| 184 | <p> Postfix ++. Makes the next item the new current item and returns
|
|---|
| 185 | the item that <em>was</em> the current item.
|
|---|
| 186 |
|
|---|
| 187 | <h3 class=fn><a href="qlistviewitemiterator.html">QListViewItemIterator</a> & <a name="operator+-eq"></a>QListViewItemIterator::operator+= ( int j )
|
|---|
| 188 | </h3>
|
|---|
| 189 | Sets the current item to the item <em>j</em> positions after the current
|
|---|
| 190 | item. If that item is beyond the last item, the current item is
|
|---|
| 191 | set to 0. Returns the current item.
|
|---|
| 192 |
|
|---|
| 193 | <h3 class=fn><a href="qlistviewitemiterator.html">QListViewItemIterator</a> & <a name="operator--"></a>QListViewItemIterator::operator-- ()
|
|---|
| 194 | </h3>
|
|---|
| 195 | Prefix --. Makes the previous item the new current item and
|
|---|
| 196 | returns it. Returns 0 if the current item is the first item or the
|
|---|
| 197 | <a href="qlistview.html">QListView</a> is 0.
|
|---|
| 198 |
|
|---|
| 199 | <h3 class=fn>const <a href="qlistviewitemiterator.html">QListViewItemIterator</a> <a name="operator---2"></a>QListViewItemIterator::operator-- ( int )
|
|---|
| 200 | </h3>
|
|---|
| 201 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|---|
| 202 | <p> Postfix --. Makes the previous item the new current item and
|
|---|
| 203 | returns the item that <em>was</em> the current item.
|
|---|
| 204 |
|
|---|
| 205 | <h3 class=fn><a href="qlistviewitemiterator.html">QListViewItemIterator</a> & <a name="operator--eq"></a>QListViewItemIterator::operator-= ( int j )
|
|---|
| 206 | </h3>
|
|---|
| 207 | Sets the current item to the item <em>j</em> positions before the
|
|---|
| 208 | current item. If that item is before the first item, the current
|
|---|
| 209 | item is set to 0. Returns the current item.
|
|---|
| 210 |
|
|---|
| 211 | <h3 class=fn><a href="qlistviewitemiterator.html">QListViewItemIterator</a> & <a name="operator-eq"></a>QListViewItemIterator::operator= ( const <a href="qlistviewitemiterator.html">QListViewItemIterator</a> & it )
|
|---|
| 212 | </h3>
|
|---|
| 213 | Assignment. Makes a copy of <em>it</em> and returns a reference to its
|
|---|
| 214 | iterator.
|
|---|
| 215 |
|
|---|
| 216 | <!-- eof -->
|
|---|
| 217 | <hr><p>
|
|---|
| 218 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
|---|
| 219 | Copyright © 1995-2007
|
|---|
| 220 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|---|
| 221 | <table width=100% cellspacing=0 border=0><tr>
|
|---|
| 222 | <td>Copyright © 2007
|
|---|
| 223 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|---|
| 224 | <td align=right><div align=right>Qt 3.3.8</div>
|
|---|
| 225 | </table></div></address></body>
|
|---|
| 226 | </html>
|
|---|