From 4c35c9e057810c9834f1bb610805a697cb74046e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alp=20=C3=96z?= Date: Mon, 2 Aug 2021 12:59:38 +0200 Subject: [PATCH] Change sorting in Class View to case insensitive Change-Id: Ia9ee6726d1d423a127c1e3e57c02ebef8a6f28dd Reviewed-by: Jarek Kobus --- src/plugins/classview/classviewsymbolinformation.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/classview/classviewsymbolinformation.cpp b/src/plugins/classview/classviewsymbolinformation.cpp index b1bee4be566..ec385d4a70d 100644 --- a/src/plugins/classview/classviewsymbolinformation.cpp +++ b/src/plugins/classview/classviewsymbolinformation.cpp @@ -123,7 +123,14 @@ bool SymbolInformation::operator<(const SymbolInformation &other) const return false; } - int cmp = name().compare(other.name()); + // The desired behavior here is to facilitate case insensitive + // sorting without generating false case sensitive equalities. + // Performance should be appropriate since in C++ there aren't + // many symbols that differ by case only. + + int cmp = name().compare(other.name(), Qt::CaseInsensitive); + if (cmp == 0) + cmp = name().compare(other.name()); if (cmp < 0) return true; if (cmp > 0)