Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_io_qdiriterator.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QDirIterator>
5
6void examples()
7{
8 {
9 //! [0]
10 QDirIterator it("/etc", QDirIterator::Subdirectories);
11 while (it.hasNext()) {
12 QString dir = it.next();
13 qDebug() << dir;
14 // /etc/.
15 // /etc/..
16 // /etc/X11
17 // /etc/X11/fs
18 // ...
19 }
20 //! [0]
21 }
22
23 //! [1]
24 QDirIterator it("/sys", QStringList() << "scaling_cur_freq", QDir::NoFilter, QDirIterator::Subdirectories);
25 while (it.hasNext()) {
26 QFile f(it.next());
27 f.open(QIODevice::ReadOnly);
28 qDebug() << f.fileName() << f.readAll().trimmed().toDouble() / 1000 << "MHz";
29 }
30 //! [1]
31
32 QString audioPath = "/path/to/audio/files";
33 //! [2]
34 QDirIterator audioFileIt(audioPath, {"*.mp3", "*.wav"}, QDir::Files);
35 //! [2]
36}
bool examples()
[3]