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
This commit is contained in:
Thorbjørn Lindeijer
2008-12-09 17:16:26 +01:00
parent 5f544b4daf
commit 1e8b9167ef

View File

@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &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)
{
QString entry = trimWildcards(origEntry);
@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
}
}
if (entries.size() < 1000)
qSort(entries.begin(), entries.end(), compareLexigraphically);
return entries;
}