Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 630

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QDirIterator 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="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">QDirIterator Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QDirIterator class provides an iterator for directory
entrylists. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdiriterator.html#IteratorFlag-enum">IteratorFlag</a></b> { NoIteratorFlags, FollowSymlinks, Subdirectories }</li><li><div class="fn" />class <b><a href="qdiriterator-iteratorflags.html">IteratorFlags</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdiriterator.html#QDirIterator">__init__</a></b> (<i>self</i>, QDir&#160;<i>dir</i>, IteratorFlags&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</li><li><div class="fn" /><b><a href="qdiriterator.html#QDirIterator-2">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>, IteratorFlags&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</li><li><div class="fn" /><b><a href="qdiriterator.html#QDirIterator-3">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>, QDir.Filters&#160;<i>filters</i>, IteratorFlags&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</li><li><div class="fn" /><b><a href="qdiriterator.html#QDirIterator-4">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>, QStringList&#160;<i>nameFilters</i>, QDir.Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, IteratorFlags&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</li><li><div class="fn" />QFileInfo <b><a href="qdiriterator.html#fileInfo">fileInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdiriterator.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdiriterator.html#filePath">filePath</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdiriterator.html#hasNext">hasNext</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdiriterator.html#next">next</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdiriterator.html#path">path</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDirIterator class provides an iterator for directory
entrylists.</p>
<p>You can use QDirIterator to navigate entries of a directory one
at a time. It is similar to <a href="qdir.html#entryList">QDir.entryList</a>() and <a href="qdir.html#entryInfoList">QDir.entryInfoList</a>(), but because it
lists entries one at a time instead of all at once, it scales
better and is more suitable for large directories. It also supports
listing directory contents recursively, and following symbolic
links. Unlike <a href="qdir.html#entryList">QDir.entryList</a>(),
QDirIterator does not support sorting.</p>
<p>The QDirIterator constructor takes a <a href="qdir.html">QDir</a> or a directory as argument. After
construction, the iterator is located before the first directory
entry. Here's how to iterate over all the entries sequentially:</p>
<pre class="cpp">
 <span class="type">QDirIterator</span> it(<span class="string">"/etc"</span><span class="operator">,</span> <span class="type">QDirIterator</span><span class="operator">.</span>Subdirectories);
 <span class="keyword">while</span> (it<span class="operator">.</span>hasNext()) {
     <a href="qtcore.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>next();

     <span class="comment">// /etc/.</span>
     <span class="comment">// /etc/..</span>
     <span class="comment">// /etc/X11</span>
     <span class="comment">// /etc/X11/fs</span>
     <span class="comment">// ...</span>
 }
</pre>
<p>The <a href="qdiriterator.html#next">next</a>() function returns
the path to the next directory entry and advances the iterator. You
can also call <a href="qdiriterator.html#filePath">filePath</a>()
to get the current file path without advancing the iterator. The
<a href="qdiriterator.html#fileName">fileName</a>() function
returns only the name of the file, similar to how <a href="qdir.html#entryList">QDir.entryList</a>() works. You can also
call <a href="qdiriterator.html#fileInfo">fileInfo</a>() to get a
<a href="qfileinfo.html">QFileInfo</a> for the current entry.</p>
<p>Unlike Qt's container iterators, QDirIterator is uni-directional
(i.e., you cannot iterate directories in reverse order) and does
not allow random access.</p>
<p>QDirIterator works with all supported file engines, and is
implemented using <a href="qabstractfileengineiterator.html">QAbstractFileEngineIterator</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="IteratorFlag-enum" />QDirIterator.IteratorFlag</h3><p>This enum describes flags that you can combine to configure the
behavior of <a href="qdiriterator.html">QDirIterator</a>.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QDirIterator.NoIteratorFlags</tt></td>
<td class="topAlign"><tt>0x0</tt></td>
<td class="topAlign">The default value, representing no flags. The
iterator will return entries for the assigned path.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDirIterator.Subdirectories</tt></td>
<td class="topAlign"><tt>0x2</tt></td>
<td class="topAlign">List entries inside all subdirectories as
well.</td>
</tr>
<tr>
<td class="topAlign"><tt>QDirIterator.FollowSymlinks</tt></td>
<td class="topAlign"><tt>0x1</tt></td>
<td class="topAlign">When combined with Subdirectories, this flag
enables iterating through all subdirectories of the assigned path,
following all symbolic links. Symbolic link loops (e.g., "link"
=&gt; "." or "link" =&gt; "..") are automatically detected and
ignored.</td>
</tr>
</table>
<p>The IteratorFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;IteratorFlag&gt;. It stores an OR
combination of IteratorFlag values.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDirIterator" />QDirIterator.__init__ (<i>self</i>, <a href="qdir.html">QDir</a>&#160;<i>dir</i>, <a href="qdiriterator-iteratorflags.html">IteratorFlags</a>&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</h3><p>Constructs a <a href="qdiriterator.html">QDirIterator</a> that
can iterate over <i>dir</i>'s entrylist, using <i>dir</i>'s name
filters and regular filters. You can pass options via <i>flags</i>
to decide how the directory should be iterated.</p>
<p>By default, <i>flags</i> is <a href="qdiriterator.html#IteratorFlag-enum">NoIteratorFlags</a>, which
provides the same behavior as in <a href="qdir.html#entryList">QDir.entryList</a>().</p>
<p>The sorting in <i>dir</i> is ignored.</p>
<p><b>Note:</b> To list symlinks that point to non existing files,
<a href="qdir.html#Filter-enum">QDir.System</a> must be passed to
the flags.</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">hasNext</a>(), <a href="qdiriterator.html#next">next</a>(), and <a href="qdiriterator.html#IteratorFlag-enum">IteratorFlags</a>.</p>


<h3 class="fn"><a name="QDirIterator-2" />QDirIterator.__init__ (<i>self</i>, QString&#160;<i>path</i>, <a href="qdiriterator-iteratorflags.html">IteratorFlags</a>&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</h3><p>Constructs a <a href="qdiriterator.html">QDirIterator</a> that
can iterate over <i>path</i>. You can pass options via <i>flags</i>
to decide how the directory should be iterated.</p>
<p>By default, <i>flags</i> is <a href="qdiriterator.html#IteratorFlag-enum">NoIteratorFlags</a>, which
provides the same behavior as in <a href="qdir.html#entryList">QDir.entryList</a>().</p>
<p><b>Note:</b> To list symlinks that point to non existing files,
<a href="qdir.html#Filter-enum">QDir.System</a> must be passed to
the flags.</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">hasNext</a>(), <a href="qdiriterator.html#next">next</a>(), and <a href="qdiriterator.html#IteratorFlag-enum">IteratorFlags</a>.</p>


<h3 class="fn"><a name="QDirIterator-3" />QDirIterator.__init__ (<i>self</i>, QString&#160;<i>path</i>, <a href="qdir-filters.html">QDir.Filters</a>&#160;<i>filters</i>, <a href="qdiriterator-iteratorflags.html">IteratorFlags</a>&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</h3><p>Constructs a <a href="qdiriterator.html">QDirIterator</a> that
can iterate over <i>path</i>, with no name filtering and
<i>filters</i> for entry filtering. You can pass options via
<i>flags</i> to decide how the directory should be iterated.</p>
<p>By default, <i>filters</i> is <a href="qdir.html#Filter-enum">QDir.NoFilter</a>, and <i>flags</i> is
<a href="qdiriterator.html#IteratorFlag-enum">NoIteratorFlags</a>,
which provides the same behavior as in <a href="qdir.html#entryList">QDir.entryList</a>().</p>
<p><b>Note:</b> To list symlinks that point to non existing files,
<a href="qdir.html#Filter-enum">QDir.System</a> must be passed to
the flags.</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">hasNext</a>(), <a href="qdiriterator.html#next">next</a>(), and <a href="qdiriterator.html#IteratorFlag-enum">IteratorFlags</a>.</p>


<h3 class="fn"><a name="QDirIterator-4" />QDirIterator.__init__ (<i>self</i>, QString&#160;<i>path</i>, QStringList&#160;<i>nameFilters</i>, <a href="qdir-filters.html">QDir.Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdiriterator-iteratorflags.html">IteratorFlags</a>&#160;<i>flags</i>&#160;=&#160;QDirIterator.NoIteratorFlags)</h3><p>Constructs a <a href="qdiriterator.html">QDirIterator</a> that
can iterate over <i>path</i>, using <i>nameFilters</i> and
<i>filters</i>. You can pass options via <i>flags</i> to decide how
the directory should be iterated.</p>
<p>By default, <i>flags</i> is <a href="qdiriterator.html#IteratorFlag-enum">NoIteratorFlags</a>, which
provides the same behavior as <a href="qdir.html#entryList">QDir.entryList</a>().</p>
<p><b>Note:</b> To list symlinks that point to non existing files,
<a href="qdir.html#Filter-enum">QDir.System</a> must be passed to
the flags.</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">hasNext</a>(), <a href="qdiriterator.html#next">next</a>(), and <a href="qdiriterator.html#IteratorFlag-enum">IteratorFlags</a>.</p>


<h3 class="fn"><a name="fileInfo" /><a href="qfileinfo.html">QFileInfo</a> QDirIterator.fileInfo (<i>self</i>)</h3><p>Returns a <a href="qfileinfo.html">QFileInfo</a> for the current
directory entry.</p>
<p><b>See also</b> <a href="qdiriterator.html#filePath">filePath</a>() and <a href="qdiriterator.html#fileName">fileName</a>().</p>


<h3 class="fn"><a name="fileName" />QString QDirIterator.fileName (<i>self</i>)</h3><p>Returns the file name for the current directory entry, without
the path prepended.</p>
<p>This function is convenient when iterating a single directory.
When using the <a href="qdiriterator.html#IteratorFlag-enum">QDirIterator.Subdirectories</a>
flag, you can use <a href="qdiriterator.html#filePath">filePath</a>() to get the full
path.</p>
<p><b>See also</b> <a href="qdiriterator.html#filePath">filePath</a>() and <a href="qdiriterator.html#fileInfo">fileInfo</a>().</p>


<h3 class="fn"><a name="filePath" />QString QDirIterator.filePath (<i>self</i>)</h3><p>Returns the full file path for the current directory entry.</p>
<p><b>See also</b> <a href="qdiriterator.html#fileInfo">fileInfo</a>() and <a href="qdiriterator.html#fileName">fileName</a>().</p>


<h3 class="fn"><a name="hasNext" />bool QDirIterator.hasNext (<i>self</i>)</h3><p>Returns true if there is at least one more entry in the
directory; otherwise, false is returned.</p>
<p><b>See also</b> <a href="qdiriterator.html#next">next</a>(),
<a href="qdiriterator.html#fileName">fileName</a>(), <a href="qdiriterator.html#filePath">filePath</a>(), and <a href="qdiriterator.html#fileInfo">fileInfo</a>().</p>


<h3 class="fn"><a name="next" />QString QDirIterator.next (<i>self</i>)</h3><p>Advances the iterator to the next entry, and returns the file
path of this new entry. If <a href="qdiriterator.html#hasNext">hasNext</a>() returns false, this
function does nothing, and returns a null <a href="qstring.html">QString</a>.</p>
<p>You can call <a href="qdiriterator.html#fileName">fileName</a>()
or <a href="qdiriterator.html#filePath">filePath</a>() to get the
current entry file name or path, or <a href="qdiriterator.html#fileInfo">fileInfo</a>() to get a <a href="qfileinfo.html">QFileInfo</a> for the current entry.</p>
<p><b>See also</b> <a href="qdiriterator.html#hasNext">hasNext</a>(), <a href="qdiriterator.html#fileName">fileName</a>(), <a href="qdiriterator.html#filePath">filePath</a>(), and <a href="qdiriterator.html#fileInfo">fileInfo</a>().</p>


<h3 class="fn"><a name="path" />QString QDirIterator.path (<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.10.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> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>