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

@@ -389,9 +389,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
}
}
Utils::sort(result, &CMakeConfigItem::less);
return result;
return Utils::sorted(std::move(result), &CMakeConfigItem::less);
}
QString CMakeConfigItem::toString(const Utils::MacroExpander *expander) const

View File

@@ -433,8 +433,8 @@ private:
cmakeLabel->setText(m_currentTool->cmakeExecutable().toUserOutput());
QList<CMakeTool::Generator> generatorList = m_currentTool->supportedGenerators();
Utils::sort(generatorList, &CMakeTool::Generator::name);
const QList<CMakeTool::Generator> generatorList = Utils::sorted(
m_currentTool->supportedGenerators(), &CMakeTool::Generator::name);
for (auto it = generatorList.constBegin(); it != generatorList.constEnd(); ++it)
generatorCombo->addItem(it->name);

View File

@@ -459,8 +459,8 @@ void CMakeTool::parseFunctionDetailsOutput(const QString &output)
if (!words.isEmpty()) {
const QString command = words.takeFirst();
if (functionSet.contains(command)) {
QStringList tmp = words + m_introspection->m_functionArgs[command];
Utils::sort(tmp);
const QStringList tmp = Utils::sorted(
words + m_introspection->m_functionArgs[command]);
m_introspection->m_functionArgs[command] = Utils::filteredUnique(tmp);
}
}