PDA

View Full Version : QDir sort by QDir::Type problem



tsuibin
19th February 2016, 08:59
mkdir bbd ssd
touch cca ccb

when use QDir like this


QDir mydir("/path");

QStringList desktopList = mydir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden |QDir::System, QDir::Type );

qDebug() << "desktopList" << desktopList;

the right result is :
bbd ssd cca ccb

but
result is :
bbd cca ccb ssd


bbd,ssd is dir

anda_skoa
19th February 2016, 09:36
You forgot the QDir::DirsFirst sort flag.

Cheers,
_