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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3listview.cpp -->
<title>Qt 4.8: Q3ListViewItemIterator Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li>Qt3SupportLight</li>
<li>Q3ListViewItemIterator</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3ListViewItemIterator Class Reference</h1>
<!-- $$$Q3ListViewItemIterator-brief -->
<p>The Q3ListViewItemIterator class provides an iterator for collections of Q3ListViewItems. <a href="#details">More...</a></p>
<!-- @@@Q3ListViewItemIterator -->
<pre class="cpp"> <span class="preprocessor">#include <Q3ListViewItemIterator></span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html">Porting to Qt 4</a> for more information.</p>
<ul>
<li><a href="q3listviewitemiterator-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#IteratorFlag-enum">IteratorFlag</a></b> { Visible, Invisible, Selected, Unselected, ..., NotChecked }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator">Q3ListViewItemIterator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator-2">Q3ListViewItemIterator</a></b> ( Q3ListViewItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator-3">Q3ListViewItemIterator</a></b> ( Q3ListViewItem * <i>item</i>, int <i>iteratorFlags</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator-4">Q3ListViewItemIterator</a></b> ( const Q3ListViewItemIterator & <i>it</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator-5">Q3ListViewItemIterator</a></b> ( Q3ListView * <i>lv</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#Q3ListViewItemIterator-6">Q3ListViewItemIterator</a></b> ( Q3ListView * <i>lv</i>, int <i>iteratorFlags</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#dtor.Q3ListViewItemIterator">~Q3ListViewItemIterator</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItem * </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#current">current</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItem * </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator-2a">operator*</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItemIterator & </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator-2b-2b">operator++</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const Q3ListViewItemIterator </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator-2b-2b-2">operator++</a></b> ( int )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItemIterator & </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator-2b-eq">operator+=</a></b> ( int <i>j</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItemIterator & </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator--">operator--</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const Q3ListViewItemIterator </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator---2">operator--</a></b> ( int )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItemIterator & </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator--eq">operator-=</a></b> ( int <i>j</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3ListViewItemIterator & </td><td class="memItemRight bottomAlign"><b><a href="q3listviewitemiterator.html#operator-eq">operator=</a></b> ( const Q3ListViewItemIterator & <i>it</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$Q3ListViewItemIterator-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3ListViewItemIterator class provides an iterator for collections of Q3ListViewItems.</p>
<p>Construct an instance of a Q3ListViewItemIterator, with either a <a href="q3listview.html">Q3ListView</a>* or a <a href="q3listviewitem.html">Q3ListViewItem</a>* as argument, to operate on the tree of Q3ListViewItems, starting from the argument.</p>
<p>A Q3ListViewItemIterator iterates over all the items from its starting point. This means that it always makes the first child of the current item the new current item. If there is no child, the next sibling becomes the new current item; and if there is no next sibling, the next sibling of the parent becomes current.</p>
<p>The following example creates a list of all the items that have been selected by the user, storing pointers to the items in a <a href="qlist.html">QList</a>:</p>
<pre class="cpp"> <span class="type"><a href="qlist.html">QList</a></span><span class="operator"><</span><span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> <span class="operator">*</span><span class="operator">></span> lst;
<span class="type">Q3ListViewItemIterator</span> it(myListView);
<span class="keyword">while</span> (it<span class="operator">.</span>current()) {
<span class="keyword">if</span> (it<span class="operator">.</span>current()<span class="operator">-</span><span class="operator">></span>isSelected())
lst<span class="operator">.</span>append(it<span class="operator">.</span>current());
<span class="operator">+</span><span class="operator">+</span>it;
}</pre>
<p>An alternative approach is to use an <tt>IteratorFlag</tt>:</p>
<pre class="cpp"> <span class="type"><a href="qlist.html">QList</a></span><span class="operator"><</span><span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> <span class="operator">*</span><span class="operator">></span> lst;
<span class="type">Q3ListViewItemIterator</span> it(myListView<span class="operator">,</span> <span class="type">Q3ListViewItemIterator</span><span class="operator">::</span>Selected);
<span class="keyword">while</span> (it<span class="operator">.</span>current()) {
lst<span class="operator">.</span>append(it<span class="operator">.</span>current());
<span class="operator">+</span><span class="operator">+</span>it;
}</pre>
<p>A Q3ListViewItemIterator provides a convenient and easy way to traverse a hierarchical <a href="q3listview.html">Q3ListView</a>.</p>
<p>Multiple Q3ListViewItemIterators can operate on the tree of Q3ListViewItems. A <a href="q3listview.html">Q3ListView</a> knows about all iterators operating on its Q3ListViewItems. So when a <a href="q3listviewitem.html">Q3ListViewItem</a> gets removed all iterators that point to this item are updated and point to the following item if possible, otherwise to a valid item before the current one or to 0. Note however that deleting the parent item of an item that an iterator points to is not safe.</p>
</div>
<p><b>See also </b><a href="q3listview.html">Q3ListView</a> and <a href="q3listviewitem.html">Q3ListViewItem</a>.</p>
<!-- @@@Q3ListViewItemIterator -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$IteratorFlag$$$Visible$$$Invisible$$$Selected$$$Unselected$$$Selectable$$$NotSelectable$$$DragEnabled$$$DragDisabled$$$DropEnabled$$$DropDisabled$$$Expandable$$$NotExpandable$$$Checked$$$NotChecked -->
<h3 class="fn"><a name="IteratorFlag-enum"></a>enum Q3ListViewItemIterator::<span class="name">IteratorFlag</span></h3>
<p>These flags can be passed to a <a href="q3listviewitemiterator.html" class="compat">Q3ListViewItemIterator</a> constructor (OR-ed together if more than one is used), so that the iterator will only iterate over items that match the given flags.</p>
<table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Visible</tt></td><td class="topAlign"><tt>0x00000001</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Invisible</tt></td><td class="topAlign"><tt>0x00000002</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Selected</tt></td><td class="topAlign"><tt>0x00000004</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Unselected</tt></td><td class="topAlign"><tt>0x00000008</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Selectable</tt></td><td class="topAlign"><tt>0x00000010</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::NotSelectable</tt></td><td class="topAlign"><tt>0x00000020</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::DragEnabled</tt></td><td class="topAlign"><tt>0x00000040</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::DragDisabled</tt></td><td class="topAlign"><tt>0x00000080</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::DropEnabled</tt></td><td class="topAlign"><tt>0x00000100</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::DropDisabled</tt></td><td class="topAlign"><tt>0x00000200</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Expandable</tt></td><td class="topAlign"><tt>0x00000400</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::NotExpandable</tt></td><td class="topAlign"><tt>0x00000800</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::Checked</tt></td><td class="topAlign"><tt>0x00001000</tt></td></tr>
<tr><td class="topAlign"><tt>Q3ListViewItemIterator::NotChecked</tt></td><td class="topAlign"><tt>0x00002000</tt></td></tr>
</table>
<!-- @@@IteratorFlag -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3ListViewItemIterator[overload1]$$$Q3ListViewItemIterator -->
<h3 class="fn"><a name="Q3ListViewItemIterator"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ()</h3>
<p>Constructs an empty iterator.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$Q3ListViewItemIterator$$$Q3ListViewItemIteratorQ3ListViewItem* -->
<h3 class="fn"><a name="Q3ListViewItemIterator-2"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ( <span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> * <i>item</i> )</h3>
<p>Constructs an iterator for the <a href="q3listview.html" class="compat">Q3ListView</a> that contains the <i>item</i>. The current iterator item is set to point to the <i>item</i>.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$Q3ListViewItemIterator$$$Q3ListViewItemIteratorQ3ListViewItem*int -->
<h3 class="fn"><a name="Q3ListViewItemIterator-3"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ( <span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> * <i>item</i>, <span class="type">int</span> <i>iteratorFlags</i> )</h3>
<p>Constructs an iterator for the <a href="q3listview.html" class="compat">Q3ListView</a> that contains the <i>item</i> using the flags <i>iteratorFlags</i>. The current iterator item is set to point to <i>item</i> or the next matching item if <i>item</i> doesn't match the flags.</p>
<p><b>See also </b><a href="q3listviewitemiterator.html#IteratorFlag-enum">Q3ListViewItemIterator::IteratorFlag</a>.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$Q3ListViewItemIterator$$$Q3ListViewItemIteratorconstQ3ListViewItemIterator& -->
<h3 class="fn"><a name="Q3ListViewItemIterator-4"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ( const <span class="type">Q3ListViewItemIterator</span> & <i>it</i> )</h3>
<p>Constructs an iterator for the same <a href="q3listview.html" class="compat">Q3ListView</a> as <i>it</i>. The current iterator item is set to point on the current item of <i>it</i>.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$Q3ListViewItemIterator$$$Q3ListViewItemIteratorQ3ListView* -->
<h3 class="fn"><a name="Q3ListViewItemIterator-5"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ( <span class="type"><a href="q3listview.html">Q3ListView</a></span> * <i>lv</i> )</h3>
<p>Constructs an iterator for the <a href="q3listview.html" class="compat">Q3ListView</a> <i>lv</i>. The current iterator item is set to point on the first child (<a href="q3listviewitem.html" class="compat">Q3ListViewItem</a>) of <i>lv</i>.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$Q3ListViewItemIterator$$$Q3ListViewItemIteratorQ3ListView*int -->
<h3 class="fn"><a name="Q3ListViewItemIterator-6"></a>Q3ListViewItemIterator::<span class="name">Q3ListViewItemIterator</span> ( <span class="type"><a href="q3listview.html">Q3ListView</a></span> * <i>lv</i>, <span class="type">int</span> <i>iteratorFlags</i> )</h3>
<p>Constructs an iterator for the <a href="q3listview.html" class="compat">Q3ListView</a> <i>lv</i> with the flags <i>iteratorFlags</i>. The current iterator item is set to point on the first child (<a href="q3listviewitem.html" class="compat">Q3ListViewItem</a>) of <i>lv</i> that matches the flags.</p>
<p><b>See also </b><a href="q3listviewitemiterator.html#IteratorFlag-enum">Q3ListViewItemIterator::IteratorFlag</a>.</p>
<!-- @@@Q3ListViewItemIterator -->
<!-- $$$~Q3ListViewItemIterator[overload1]$$$~Q3ListViewItemIterator -->
<h3 class="fn"><a name="dtor.Q3ListViewItemIterator"></a>Q3ListViewItemIterator::<span class="name">~Q3ListViewItemIterator</span> ()</h3>
<p>Destroys the iterator.</p>
<!-- @@@~Q3ListViewItemIterator -->
<!-- $$$current[overload1]$$$current -->
<h3 class="fn"><a name="current"></a><span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> * Q3ListViewItemIterator::<span class="name">current</span> () const</h3>
<p>Returns iterator's current item.</p>
<!-- @@@current -->
<!-- $$$operator*[overload1]$$$operator* -->
<h3 class="fn"><a name="operator-2a"></a><span class="type"><a href="q3listviewitem.html">Q3ListViewItem</a></span> * Q3ListViewItemIterator::<span class="name">operator*</span> ()</h3>
<p>Dereference operator. Returns a reference to the current item. The same as <a href="q3listviewitemiterator.html#current">current</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator++[overload1]$$$operator++ -->
<h3 class="fn"><a name="operator-2b-2b"></a><span class="type">Q3ListViewItemIterator</span> & Q3ListViewItemIterator::<span class="name">operator++</span> ()</h3>
<p>Prefix ++. Makes the next item the new current item and returns it. Returns 0 if the current item is the last item or the <a href="q3listview.html" class="compat">Q3ListView</a> is 0.</p>
<!-- @@@operator++ -->
<!-- $$$operator++$$$operator++int -->
<h3 class="fn"><a name="operator-2b-2b-2"></a>const <span class="type">Q3ListViewItemIterator</span> Q3ListViewItemIterator::<span class="name">operator++</span> ( <span class="type">int</span> )</h3>
<p>This is an overloaded function.</p>
<p>Postfix ++. Makes the next item the new current item and returns the item that <i>was</i> the current item.</p>
<!-- @@@operator++ -->
<!-- $$$operator+=[overload1]$$$operator+=int -->
<h3 class="fn"><a name="operator-2b-eq"></a><span class="type">Q3ListViewItemIterator</span> & Q3ListViewItemIterator::<span class="name">operator+=</span> ( <span class="type">int</span> <i>j</i> )</h3>
<p>Sets the current item to the item <i>j</i> positions after the current item. If that item is beyond the last item, the current item is set to 0. Returns the current item.</p>
<!-- @@@operator+= -->
<!-- $$$operator--[overload1]$$$operator-- -->
<h3 class="fn"><a name="operator--"></a><span class="type">Q3ListViewItemIterator</span> & Q3ListViewItemIterator::<span class="name">operator--</span> ()</h3>
<p>Prefix --. Makes the previous item the new current item and returns it. Returns 0 if the current item is the first item or the <a href="q3listview.html" class="compat">Q3ListView</a> is 0.</p>
<!-- @@@operator-- -->
<!-- $$$operator--$$$operator--int -->
<h3 class="fn"><a name="operator---2"></a>const <span class="type">Q3ListViewItemIterator</span> Q3ListViewItemIterator::<span class="name">operator--</span> ( <span class="type">int</span> )</h3>
<p>This is an overloaded function.</p>
<p>Postfix --. Makes the previous item the new current item and returns the item that <i>was</i> the current item.</p>
<!-- @@@operator-- -->
<!-- $$$operator-=[overload1]$$$operator-=int -->
<h3 class="fn"><a name="operator--eq"></a><span class="type">Q3ListViewItemIterator</span> & Q3ListViewItemIterator::<span class="name">operator-=</span> ( <span class="type">int</span> <i>j</i> )</h3>
<p>Sets the current item to the item <i>j</i> positions before the current item. If that item is before the first item, the current item is set to 0. Returns the current item.</p>
<!-- @@@operator-= -->
<!-- $$$operator=[overload1]$$$operator=constQ3ListViewItemIterator& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">Q3ListViewItemIterator</span> & Q3ListViewItemIterator::<span class="name">operator=</span> ( const <span class="type">Q3ListViewItemIterator</span> & <i>it</i> )</h3>
<p>Assignment. Makes a copy of <i>it</i> and returns a reference to its iterator.</p>
<!-- @@@operator= -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|