Doc: provide a code example of QDirIterator's nameFilters parameter

Change-Id: I56f9251f17bab0f835979a5feadec1fa896c9d69
Pick-to: 5.15
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
This commit is contained in:
Mitch Curtis 2020-08-17 15:38:47 +02:00
parent 7127bf1d04
commit 0c52e600b3
2 changed files with 10 additions and 1 deletions

View File

@ -69,3 +69,7 @@ while (it.hasNext()) {
qDebug() << f.fileName() << f.readAll().trimmed().toDouble() / 1000 << "MHz";
}
//! [1]
//! [2]
QDirIterator audioFileIt(audioPath, {"*.mp3", "*.wav"}, QDir::Files);
//! [2]

View File

@ -462,10 +462,15 @@ QDirIterator::QDirIterator(const QString &path, IteratorFlags flags)
By default, \a flags is NoIteratorFlags, which provides the same behavior
as QDir::entryList().
For example, the following iterator could be used to iterate over audio
files:
\snippet code/src_corelib_io_qdiriterator.cpp 2
\note To list symlinks that point to non existing files, QDir::System must be
passed to the flags.
\sa hasNext(), next(), IteratorFlags
\sa hasNext(), next(), IteratorFlags, QDir::setNameFilters()
*/
QDirIterator::QDirIterator(const QString &path, const QStringList &nameFilters,
QDir::Filters filters, IteratorFlags flags)