Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.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
5#include <QDir>
6#include <iostream>
7
8int main(int argc, char *argv[])
9{
10 QCoreApplication app(argc, argv);
11 QDir dir;
13 dir.setSorting(QDir::Size | QDir::Reversed);
14
15 QFileInfoList list = dir.entryInfoList();
16 std::cout << " Bytes Filename" << std::endl;
17 for (int i = 0; i < list.size(); ++i) {
18 QFileInfo fileInfo = list.at(i);
19 std::cout << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10)
20 .arg(fileInfo.fileName()));
21 std::cout << std::endl;
22 }
23 return 0;
24}
\inmodule QtCore
\inmodule QtCore
Definition qdir.h:20
@ Size
Definition qdir.h:52
@ Reversed
Definition qdir.h:57
@ Files
Definition qdir.h:23
@ Hidden
Definition qdir.h:35
@ NoSymLinks
Definition qdir.h:25
QString fileName() const
qint64 size() const
Returns the file size in bytes.
qsizetype size() const noexcept
Definition qlist.h:397
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
int main()
[0]
SSL_CTX int void * arg
#define qPrintable(string)
Definition qstring.h:1531
QList< int > list
[14]
QString dir
[11]
QApplication app(argc, argv)
[0]