From 1419657a70fa3129e69e40a12ab88ee19f8a1c05 Mon Sep 17 00:00:00 2001 From: the-bebop <62464098+the-bebop@users.noreply.github.com> Date: Thu, 7 Jan 2021 16:29:53 +0100 Subject: [PATCH] Use case insensitive alphabetical sort in tree-browsers (#5875) * sort items in tree-browsers caseinsensitively in alphabetical order --- src/gui/FileBrowser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index 9ba634ea56a..60b62d9a275 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -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 items; files = thisDir.entryList( QDir::Files, QDir::Name ); + files.sort(Qt::CaseInsensitive); for( QStringList::const_iterator it = files.constBegin(); it != files.constEnd(); ++it ) {