forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user