Commit b17b2461 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Simplify Utils::sort calls that sort by member

Change-Id: I0937e98014f223f42fbf1c6b2bd94fb109bc8870
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 670e5434
......@@ -391,8 +391,7 @@ void PluginView::updatePlugins()
collections.append(new CollectionItem(tr("Utilities"), plugins, this));
}
Utils::sort(collections, [](CollectionItem *a, CollectionItem *b) -> bool
{ return a->m_name < b->m_name; });
Utils::sort(collections, &CollectionItem::m_name);
foreach (CollectionItem *collection, collections)
m_model->rootItem()->appendChild(collection);
......
......@@ -420,9 +420,7 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze()
m_extraToolChainInfo);
}
Utils::sort(units, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool {
return a1.file < a2.file;
});
Utils::sort(units, &AnalyzeUnit::file);
return units;
}
......
......@@ -234,8 +234,7 @@ void FindPrivate::setupFilterMenuItems()
bool haveEnabledFilters = false;
const Id base("FindFilter.");
QList<IFindFilter *> sortedFilters = findInterfaces;
Utils::sort(sortedFilters, [](IFindFilter *a, IFindFilter *b) -> bool
{ return a->displayName() < b->displayName(); });
Utils::sort(sortedFilters, &IFindFilter::displayName);
foreach (IFindFilter *filter, sortedFilters) {
QAction *action = new QAction(QLatin1String(" ") + filter->displayName(), this);
bool isEnabled = filter->isEnabled();
......
......@@ -127,9 +127,7 @@ LineForNewIncludeDirective::LineForNewIncludeDirective(const QTextDocument *text
{
QList<Document::Include> includes
= cppDocument->resolvedIncludes() + cppDocument->unresolvedIncludes();
Utils::sort(includes, [](const Include &left, const Include &right) {
return left.line() < right.line();
});
Utils::sort(includes, &Include::line);
// Ignore *.moc includes if requested
if (mocIncludeMode == IgnoreMocIncludes) {
......
......@@ -248,9 +248,7 @@ void RunSettingsWidget::aboutToShowAddMenu()
}
}
Utils::sort(menuActions, [](const QAction *l, const QAction *r) {
return l->text() < r->text();
});
Utils::sort(menuActions, &QAction::text);
foreach (QAction *action, menuActions)
m_addRunMenu->addAction(action);
}
......
......@@ -556,9 +556,7 @@ void QtVersionManager::setNewQtVersions(QList<BaseQtVersion *> newVersions)
// We want to preserve the same order as in the settings dialog
// so we sort a copy
QList<BaseQtVersion *> sortedNewVersions = newVersions;
Utils::sort(sortedNewVersions, [](const BaseQtVersion *l, const BaseQtVersion *r) {
return l->uniqueId() < r->uniqueId();
});
Utils::sort(sortedNewVersions, &BaseQtVersion::uniqueId);
QList<int> addedVersions;
QList<int> removedVersions;
......
......@@ -348,9 +348,7 @@ void WelcomeMode::welcomePluginAdded(QObject *obj)
void WelcomeMode::addPages(const QList<IWelcomePage *> &pages)
{
QList<IWelcomePage *> addedPages = pages;
Utils::sort(addedPages, [](const IWelcomePage *l, const IWelcomePage *r) {
return l->priority() < r->priority();
});
Utils::sort(addedPages, &IWelcomePage::priority);
// insert into m_pluginList, keeping m_pluginList sorted by priority
QQmlEngine *engine = m_welcomePage->engine();
auto addIt = addedPages.begin();
......
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