Utils: Add sorted() function

For simpler calling code.

Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2022-10-21 14:05:12 +02:00
parent 55b8ab7846
commit 13f40f5471
52 changed files with 190 additions and 163 deletions

View File

@@ -22,8 +22,7 @@ namespace TextEditor {
CodecChooser::CodecChooser(Filter filter)
{
QList<int> mibs = QTextCodec::availableMibs();
Utils::sort(mibs);
QList<int> mibs = Utils::sorted(QTextCodec::availableMibs());
QList<int>::iterator firstNonNegative =
std::find_if(mibs.begin(), mibs.end(), [](int n) { return n >=0; });
if (firstNonNegative != mibs.end())