Commit 1e8b9167 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Sort C++ QuickOpen with less than 1000 results

In this case it's fast enough and sorting the list makes it easier to
find what you're looking for.

Though because of the substring matching, what you're looking for might
still be way down the list.

Reviewed-by: con
parent 5f544b4d
...@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future) ...@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
Q_UNUSED(future); Q_UNUSED(future);
} }
static bool compareLexigraphically(const QuickOpen::FilterEntry &a,
const QuickOpen::FilterEntry &b)
{
return a.displayName < b.displayName;
}
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry) QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
{ {
QString entry = trimWildcards(origEntry); QString entry = trimWildcards(origEntry);
...@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig ...@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
} }
} }
if (entries.size() < 1000)
qSort(entries.begin(), entries.end(), compareLexigraphically);
return entries; return entries;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment