Qt just uses the OS directory iteration APIs. Are you saying that something like this:
#include <QCoreApplication>
#include <QDir>
#include <iostream>
int main(int argc, char** argv) {
dir.
setFilter(QDir::Files |
QDir::Hidden |
QDir::NoSymLinks);
dir.
setSorting(QDir::Size |
QDir::Reversed);
QFileInfoList list = dir.entryInfoList();
std::cout << " Bytes Filename" << std::endl;
for (int i = 0; i < list.size(); ++i) {
std
::cout << qPrintable
(QString("%1 %2").
arg(fileInfo.
size(),
10) .arg(fileInfo.fileName()));
std::cout << std::endl;
}
return 0;
}
#include <QCoreApplication>
#include <QDir>
#include <iostream>
int main(int argc, char** argv) {
QCoreApplication app(argc, argv);
QDir dir("/tmp/tt/a");
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Size | QDir::Reversed);
QFileInfoList list = dir.entryInfoList();
std::cout << " Bytes Filename" << std::endl;
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
std::cout << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10)
.arg(fileInfo.fileName()));
std::cout << std::endl;
}
return 0;
}
To copy to clipboard, switch view to plain text mode
does not list a file containing a single quote in its file name. Certainly does here on Linux:
13:38:09: Starting /tmp/tt/build-a-Desktop_Qt_6_1_1_GCC_64bit-Debug/a ...
Bytes Filename
0 file_with_'quote
36 a.pro
671 main.cpp
34117 a.pro.user
13:38:09: /tmp/tt/build-a-Desktop_Qt_6_1_1_GCC_64bit-Debug/a exited with code 0
13:38:09: Starting /tmp/tt/build-a-Desktop_Qt_6_1_1_GCC_64bit-Debug/a ...
Bytes Filename
0 file_with_'quote
36 a.pro
671 main.cpp
34117 a.pro.user
13:38:09: /tmp/tt/build-a-Desktop_Qt_6_1_1_GCC_64bit-Debug/a exited with code 0
To copy to clipboard, switch view to plain text mode
Bookmarks