Use case insensitive alphabetical sort in tree-browsers (#5875)

* sort items in tree-browsers caseinsensitively in alphabetical order
This commit is contained in:
the-bebop
2021-01-07 16:29:53 +01:00
committed by GitHub
parent 24761a4f77
commit f7fbb9aa16

View File

@@ -274,6 +274,7 @@ void FileBrowser::addItems(const QString & path )
// try to add all directories from file system alphabetically into the tree
QDir cdir( path );
QStringList files = cdir.entryList( QDir::Dirs, QDir::Name );
files.sort(Qt::CaseInsensitive);
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{
@@ -1081,8 +1082,13 @@ bool Directory::addItems(const QString & path )
}
}
// sorts the path alphabetically instead of just appending to the bottom (see "orphans")
if (added_something)
sortChildren(0, Qt::AscendingOrder);
QList<QTreeWidgetItem*> items;
files = thisDir.entryList( QDir::Files, QDir::Name );
files.sort(Qt::CaseInsensitive);
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{