forked from qt-creator/qt-creator
Remove use of deprecated Qt algorithms
Change-Id: Ib35cffa2d5762874feea9b1d4df7f569c0e5f496 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
d4b3789db4
commit
670e54345c
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ChildrenChangedCommand::ChildrenChangedCommand()
|
ChildrenChangedCommand::ChildrenChangedCommand()
|
||||||
@@ -58,8 +60,8 @@ QVector<InformationContainer> ChildrenChangedCommand::informations() const
|
|||||||
|
|
||||||
void ChildrenChangedCommand::sort()
|
void ChildrenChangedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_childrenVector);
|
std::sort(m_childrenVector.begin(), m_childrenVector.end());
|
||||||
qSort(m_informationVector);
|
std::sort(m_informationVector.begin(), m_informationVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command)
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
ComponentCompletedCommand::ComponentCompletedCommand()
|
ComponentCompletedCommand::ComponentCompletedCommand()
|
||||||
@@ -46,7 +48,7 @@ QVector<qint32> ComponentCompletedCommand::instances() const
|
|||||||
|
|
||||||
void ComponentCompletedCommand::sort()
|
void ComponentCompletedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_instanceVector);
|
std::sort(m_instanceVector.begin(), m_instanceVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command)
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "propertyvaluecontainer.h"
|
#include "propertyvaluecontainer.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
InformationChangedCommand::InformationChangedCommand()
|
InformationChangedCommand::InformationChangedCommand()
|
||||||
@@ -48,7 +50,7 @@ QVector<InformationContainer> InformationChangedCommand::informations() const
|
|||||||
|
|
||||||
void InformationChangedCommand::sort()
|
void InformationChangedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_informationVector);
|
std::sort(m_informationVector.begin(), m_informationVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command)
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include <QVarLengthArray>
|
#include <QVarLengthArray>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
PixmapChangedCommand::PixmapChangedCommand()
|
PixmapChangedCommand::PixmapChangedCommand()
|
||||||
@@ -47,7 +49,7 @@ QVector<ImageContainer> PixmapChangedCommand::images() const
|
|||||||
|
|
||||||
void PixmapChangedCommand::sort()
|
void PixmapChangedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_imageVector);
|
std::sort(m_imageVector.begin(), m_imageVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command)
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand()
|
StatePreviewImageChangedCommand::StatePreviewImageChangedCommand()
|
||||||
@@ -45,7 +47,7 @@ QVector<ImageContainer> StatePreviewImageChangedCommand::previews()const
|
|||||||
|
|
||||||
void StatePreviewImageChangedCommand::sort()
|
void StatePreviewImageChangedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_previewVector);
|
std::sort(m_previewVector.begin(), m_previewVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command)
|
QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command)
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
TokenCommand::TokenCommand()
|
TokenCommand::TokenCommand()
|
||||||
@@ -59,7 +61,7 @@ QVector<qint32> TokenCommand::instances() const
|
|||||||
|
|
||||||
void TokenCommand::sort()
|
void TokenCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_instanceIdVector);
|
std::sort(m_instanceIdVector.begin(), m_instanceIdVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const TokenCommand &command)
|
QDataStream &operator<<(QDataStream &out, const TokenCommand &command)
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
// using cache as a container which deletes sharedmemory pointers at process exit
|
// using cache as a container which deletes sharedmemory pointers at process exit
|
||||||
@@ -68,7 +70,7 @@ void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberV
|
|||||||
|
|
||||||
void ValuesChangedCommand::sort()
|
void ValuesChangedCommand::sort()
|
||||||
{
|
{
|
||||||
qSort(m_valueChangeVector);
|
std::sort(m_valueChangeVector.begin(), m_valueChangeVector.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QLatin1String valueKeyTemplateString("Values-%1");
|
static const QLatin1String valueKeyTemplateString("Values-%1");
|
||||||
|
@@ -275,11 +275,6 @@ using namespace ExtensionSystem::Internal;
|
|||||||
static Internal::PluginManagerPrivate *d = 0;
|
static Internal::PluginManagerPrivate *d = 0;
|
||||||
static PluginManager *m_instance = 0;
|
static PluginManager *m_instance = 0;
|
||||||
|
|
||||||
static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
|
|
||||||
{
|
|
||||||
return one->name() < two->name();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Gets the unique plugin manager instance.
|
Gets the unique plugin manager instance.
|
||||||
*/
|
*/
|
||||||
@@ -588,7 +583,7 @@ static QStringList subList(const QStringList &in, const QString &key)
|
|||||||
QStringList rc;
|
QStringList rc;
|
||||||
// Find keyword and copy arguments until end or next keyword
|
// Find keyword and copy arguments until end or next keyword
|
||||||
const QStringList::const_iterator inEnd = in.constEnd();
|
const QStringList::const_iterator inEnd = in.constEnd();
|
||||||
QStringList::const_iterator it = qFind(in.constBegin(), inEnd, key);
|
QStringList::const_iterator it = std::find(in.constBegin(), inEnd, key);
|
||||||
if (it != inEnd) {
|
if (it != inEnd) {
|
||||||
const QChar nextIndicator = QLatin1Char(':');
|
const QChar nextIndicator = QLatin1Char(':');
|
||||||
for (++it; it != inEnd && !it->startsWith(nextIndicator); ++it)
|
for (++it; it != inEnd && !it->startsWith(nextIndicator); ++it)
|
||||||
@@ -1468,7 +1463,7 @@ void PluginManagerPrivate::readPluginPaths()
|
|||||||
}
|
}
|
||||||
resolveDependencies();
|
resolveDependencies();
|
||||||
// ensure deterministic plugin load order by sorting
|
// ensure deterministic plugin load order by sorting
|
||||||
qSort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
|
Utils::sort(pluginSpecs, &PluginSpec::name);
|
||||||
emit q->pluginsChanged();
|
emit q->pluginsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@
|
|||||||
#include "qmt/diagram/dannotation.h"
|
#include "qmt/diagram/dannotation.h"
|
||||||
#include "qmt/infrastructure/qmtassert.h"
|
#include "qmt/infrastructure/qmtassert.h"
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -292,7 +294,7 @@ const Style *DefaultStyleEngine::applyObjectStyle(const Style *baseStyle, const
|
|||||||
int depth = 0;
|
int depth = 0;
|
||||||
if (!depths.isEmpty()) {
|
if (!depths.isEmpty()) {
|
||||||
QList<int> keys = depths.keys();
|
QList<int> keys = depths.keys();
|
||||||
qSort(keys);
|
Utils::sort(keys);
|
||||||
foreach (int d, keys) {
|
foreach (int d, keys) {
|
||||||
DepthProperties properties = depths.value(d);
|
DepthProperties properties = depths.value(d);
|
||||||
if (properties.m_elementType == elementType
|
if (properties.m_elementType == elementType
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "qmljsviewercontext.h"
|
#include "qmljsviewercontext.h"
|
||||||
|
|
||||||
#include <cplusplus/cppmodelmanagerbase.h>
|
#include <cplusplus/cppmodelmanagerbase.h>
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
@@ -439,9 +440,9 @@ void ModelManagerInterface::iterateQrcFiles(ProjectExplorer::Project *project,
|
|||||||
} else {
|
} else {
|
||||||
pInfos = projectInfos();
|
pInfos = projectInfos();
|
||||||
if (resources == ActiveQrcResources) // make the result predictable
|
if (resources == ActiveQrcResources) // make the result predictable
|
||||||
qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanActive);
|
Utils::sort(pInfos, &pInfoLessThanActive);
|
||||||
else
|
else
|
||||||
qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanAll);
|
Utils::sort(pInfos, &pInfoLessThanAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> pathsChecked;
|
QSet<QString> pathsChecked;
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include <qmljs/qmljsscanner.h>
|
#include <qmljs/qmljsscanner.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -410,10 +412,7 @@ int Scanner::state() const
|
|||||||
|
|
||||||
bool Scanner::isKeyword(const QString &text) const
|
bool Scanner::isKeyword(const QString &text) const
|
||||||
{
|
{
|
||||||
if (qBinaryFind(begin(js_keywords), end(js_keywords), text) != end(js_keywords))
|
return std::binary_search(begin(js_keywords), end(js_keywords), text);
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Scanner::keywords()
|
QStringList Scanner::keywords()
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static const int ArrowBorderSize = 12;
|
static const int ArrowBorderSize = 12;
|
||||||
@@ -292,10 +294,8 @@ void CrumblePath::sortChildren(Qt::SortOrder order)
|
|||||||
QTC_ASSERT(childList, return);
|
QTC_ASSERT(childList, return);
|
||||||
QList<QAction *> actions = childList->actions();
|
QList<QAction *> actions = childList->actions();
|
||||||
|
|
||||||
if (order == Qt::AscendingOrder)
|
std::stable_sort(actions.begin(), actions.end(),
|
||||||
qStableSort(actions.begin(), actions.end(), lessThan);
|
order == Qt::AscendingOrder ? lessThan : greaterThan);
|
||||||
else
|
|
||||||
qStableSort(actions.begin(), actions.end(), greaterThan);
|
|
||||||
|
|
||||||
childList->clear();
|
childList->clear();
|
||||||
childList->addActions(actions);
|
childList->addActions(actions);
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "algorithm.h"
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -55,14 +56,9 @@ Q_GLOBAL_STATIC(SystemEnvironment, staticSystemEnvironment)
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static bool sortEnvironmentItem(const EnvironmentItem &a, const EnvironmentItem &b)
|
|
||||||
{
|
|
||||||
return a.name < b.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnvironmentItem::sort(QList<EnvironmentItem> *list)
|
void EnvironmentItem::sort(QList<EnvironmentItem> *list)
|
||||||
{
|
{
|
||||||
qSort(list->begin(), list->end(), &sortEnvironmentItem);
|
Utils::sort(*list, &EnvironmentItem::name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<EnvironmentItem> EnvironmentItem::fromStringList(const QStringList &list)
|
QList<EnvironmentItem> EnvironmentItem::fromStringList(const QStringList &list)
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "fancymainwindow.h"
|
#include "fancymainwindow.h"
|
||||||
|
|
||||||
|
#include "algorithm.h"
|
||||||
#include "qtcassert.h"
|
#include "qtcassert.h"
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
@@ -505,13 +506,6 @@ bool FancyMainWindow::autoHideTitleBars() const
|
|||||||
return d->m_autoHideTitleBars.isChecked();
|
return d->m_autoHideTitleBars.isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool actionLessThan(const QAction *action1, const QAction *action2)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(action1, return true);
|
|
||||||
QTC_ASSERT(action2, return false);
|
|
||||||
return action1->text().toLower() < action2->text().toLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
|
void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
|
||||||
{
|
{
|
||||||
QList<QAction *> actions;
|
QList<QAction *> actions;
|
||||||
@@ -523,7 +517,11 @@ void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
|
|||||||
actions.append(dockwidgets.at(i)->toggleViewAction());
|
actions.append(dockwidgets.at(i)->toggleViewAction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qSort(actions.begin(), actions.end(), actionLessThan);
|
Utils::sort(actions, [](const QAction *action1, const QAction *action2) {
|
||||||
|
QTC_ASSERT(action1, return true);
|
||||||
|
QTC_ASSERT(action2, return false);
|
||||||
|
return action1->text().toLower() < action2->text().toLower();
|
||||||
|
});
|
||||||
foreach (QAction *action, actions)
|
foreach (QAction *action, actions)
|
||||||
menu->addAction(action);
|
menu->addAction(action);
|
||||||
menu->addAction(&d->m_menuSeparator1);
|
menu->addAction(&d->m_menuSeparator1);
|
||||||
|
@@ -409,16 +409,16 @@ void AndroidConfig::updateAvailableSdkPlatforms() const
|
|||||||
} else if (line.startsWith(QLatin1String("---")) || line.startsWith(QLatin1String("==="))) {
|
} else if (line.startsWith(QLatin1String("---")) || line.startsWith(QLatin1String("==="))) {
|
||||||
if (platform.apiLevel == -1)
|
if (platform.apiLevel == -1)
|
||||||
continue;
|
continue;
|
||||||
auto it = qLowerBound(m_availableSdkPlatforms.begin(), m_availableSdkPlatforms.end(),
|
auto it = std::lower_bound(m_availableSdkPlatforms.begin(), m_availableSdkPlatforms.end(),
|
||||||
platform, sortSdkPlatformByApiLevel);
|
platform, sortSdkPlatformByApiLevel);
|
||||||
m_availableSdkPlatforms.insert(it, platform);
|
m_availableSdkPlatforms.insert(it, platform);
|
||||||
platform = SdkPlatform();
|
platform = SdkPlatform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform.apiLevel != -1) {
|
if (platform.apiLevel != -1) {
|
||||||
auto it = qLowerBound(m_availableSdkPlatforms.begin(), m_availableSdkPlatforms.end(),
|
auto it = std::lower_bound(m_availableSdkPlatforms.begin(), m_availableSdkPlatforms.end(),
|
||||||
platform, sortSdkPlatformByApiLevel);
|
platform, sortSdkPlatformByApiLevel);
|
||||||
m_availableSdkPlatforms.insert(it, platform);
|
m_availableSdkPlatforms.insert(it, platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,6 +67,7 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -1337,7 +1338,8 @@ const QStringList &PermissionsModel::permissions()
|
|||||||
|
|
||||||
QModelIndex PermissionsModel::addPermission(const QString &permission)
|
QModelIndex PermissionsModel::addPermission(const QString &permission)
|
||||||
{
|
{
|
||||||
const int idx = qLowerBound(m_permissions, permission) - m_permissions.constBegin();
|
auto it = std::lower_bound(m_permissions.constBegin(), m_permissions.constEnd(), permission);
|
||||||
|
const int idx = it - m_permissions.constBegin();
|
||||||
beginInsertRows(QModelIndex(), idx, idx);
|
beginInsertRows(QModelIndex(), idx, idx);
|
||||||
m_permissions.insert(idx, permission);
|
m_permissions.insert(idx, permission);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
@@ -1351,7 +1353,8 @@ bool PermissionsModel::updatePermission(const QModelIndex &index, const QString
|
|||||||
if (m_permissions[index.row()] == permission)
|
if (m_permissions[index.row()] == permission)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int newIndex = qLowerBound(m_permissions.constBegin(), m_permissions.constEnd(), permission) - m_permissions.constBegin();
|
auto it = std::lower_bound(m_permissions.constBegin(), m_permissions.constEnd(), permission);
|
||||||
|
const int newIndex = it - m_permissions.constBegin();
|
||||||
if (newIndex == index.row() || newIndex == index.row() + 1) {
|
if (newIndex == index.row() || newIndex == index.row() + 1) {
|
||||||
m_permissions[index.row()] = permission;
|
m_permissions[index.row()] = permission;
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
@@ -251,7 +251,7 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories,
|
|||||||
{
|
{
|
||||||
m_defaultLocation = defaultLocation;
|
m_defaultLocation = defaultLocation;
|
||||||
m_extraVariables = extraVariables;
|
m_extraVariables = extraVariables;
|
||||||
qStableSort(factories.begin(), factories.end(), wizardFactoryLessThan);
|
std::stable_sort(factories.begin(), factories.end(), wizardFactoryLessThan);
|
||||||
|
|
||||||
m_model->clear();
|
m_model->clear();
|
||||||
QStandardItem *parentItem = m_model->invisibleRootItem();
|
QStandardItem *parentItem = m_model->invisibleRootItem();
|
||||||
|
@@ -70,7 +70,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
|
|||||||
static inline QList<IOptionsPage*> sortedOptionsPages()
|
static inline QList<IOptionsPage*> sortedOptionsPages()
|
||||||
{
|
{
|
||||||
QList<IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>();
|
QList<IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>();
|
||||||
qStableSort(rc.begin(), rc.end(), optionsPageLessThan);
|
std::stable_sort(rc.begin(), rc.end(), optionsPageLessThan);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ void CategoryModel::ensurePages(Category *category)
|
|||||||
|
|
||||||
category->pages += createdPages;
|
category->pages += createdPages;
|
||||||
category->providerPagesCreated = true;
|
category->providerPagesCreated = true;
|
||||||
qStableSort(category->pages.begin(), category->pages.end(), optionsPageLessThan);
|
std::stable_sort(category->pages.begin(), category->pages.end(), optionsPageLessThan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,7 @@ static bool lessThanByText(SearchResultTreeItem *a, const QString &b)
|
|||||||
int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeItem **existingItem) const
|
int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeItem **existingItem) const
|
||||||
{
|
{
|
||||||
QList<SearchResultTreeItem *>::const_iterator insertionPosition =
|
QList<SearchResultTreeItem *>::const_iterator insertionPosition =
|
||||||
qLowerBound(m_children.begin(), m_children.end(), text, lessThanByText);
|
std::lower_bound(m_children.begin(), m_children.end(), text, lessThanByText);
|
||||||
if (existingItem) {
|
if (existingItem) {
|
||||||
if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text)
|
if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text)
|
||||||
(*existingItem) = (*insertionPosition);
|
(*existingItem) = (*insertionPosition);
|
||||||
|
@@ -390,7 +390,7 @@ QList<QModelIndex> SearchResultTreeModel::addResults(const QList<SearchResultIte
|
|||||||
{
|
{
|
||||||
QSet<SearchResultTreeItem *> pathNodes;
|
QSet<SearchResultTreeItem *> pathNodes;
|
||||||
QList<SearchResultItem> sortedItems = items;
|
QList<SearchResultItem> sortedItems = items;
|
||||||
qStableSort(sortedItems.begin(), sortedItems.end(), lessThanByPath);
|
std::stable_sort(sortedItems.begin(), sortedItems.end(), lessThanByPath);
|
||||||
QList<SearchResultItem> itemSet;
|
QList<SearchResultItem> itemSet;
|
||||||
foreach (const SearchResultItem &item, sortedItems) {
|
foreach (const SearchResultItem &item, sortedItems) {
|
||||||
m_editorFontIsUsed |= item.useTextEditorFont;
|
m_editorFontIsUsed |= item.useTextEditorFont;
|
||||||
|
@@ -48,6 +48,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
namespace CMI = CppCodeModelInspector;
|
namespace CMI = CppCodeModelInspector;
|
||||||
@@ -410,7 +412,7 @@ void IncludesModel::configure(const QList<Document::Include> &includes)
|
|||||||
{
|
{
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
m_includes = includes;
|
m_includes = includes;
|
||||||
qStableSort(m_includes.begin(), m_includes.end(), includesSorter);
|
std::stable_sort(m_includes.begin(), m_includes.end(), includesSorter);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,7 +515,7 @@ void DiagnosticMessagesModel::configure(
|
|||||||
{
|
{
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
m_messages = messages;
|
m_messages = messages;
|
||||||
qStableSort(m_messages.begin(), m_messages.end(), diagnosticMessagesModelSorter);
|
std::stable_sort(m_messages.begin(), m_messages.end(), diagnosticMessagesModelSorter);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
|
|
||||||
static bool projectPartLessThan(const CppTools::ProjectPart::Ptr &projectPart1,
|
static bool projectPartLessThan(const CppTools::ProjectPart::Ptr &projectPart1,
|
||||||
@@ -58,7 +60,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(QWidget *parent, const QString &fil
|
|||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
||||||
QList<CppTools::ProjectPart::Ptr> sortedProjectParts(projectParts);
|
QList<CppTools::ProjectPart::Ptr> sortedProjectParts(projectParts);
|
||||||
qStableSort(sortedProjectParts.begin(), sortedProjectParts.end(), projectPartLessThan);
|
std::stable_sort(sortedProjectParts.begin(), sortedProjectParts.end(), projectPartLessThan);
|
||||||
|
|
||||||
foreach (CppTools::ProjectPart::Ptr projectPart, sortedProjectParts) {
|
foreach (CppTools::ProjectPart::Ptr projectPart, sortedProjectParts) {
|
||||||
m_ui->projectComboBox->addItem(projectPart->displayName);
|
m_ui->projectComboBox->addItem(projectPart->displayName);
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <QStringMatcher>
|
#include <QStringMatcher>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
@@ -107,9 +109,9 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (goodEntries.size() < 1000)
|
if (goodEntries.size() < 1000)
|
||||||
qStableSort(goodEntries.begin(), goodEntries.end(), compareLexigraphically);
|
std::stable_sort(goodEntries.begin(), goodEntries.end(), compareLexigraphically);
|
||||||
if (betterEntries.size() < 1000)
|
if (betterEntries.size() < 1000)
|
||||||
qStableSort(betterEntries.begin(), betterEntries.end(), compareLexigraphically);
|
std::stable_sort(betterEntries.begin(), betterEntries.end(), compareLexigraphically);
|
||||||
|
|
||||||
betterEntries += goodEntries;
|
betterEntries += goodEntries;
|
||||||
return betterEntries;
|
return betterEntries;
|
||||||
|
@@ -1273,7 +1273,7 @@ int WatchModel::memberVariableRecursion(WatchItem *item,
|
|||||||
const QString toolTip = variableToolTip(childName, item->type, childOffset);
|
const QString toolTip = variableToolTip(childName, item->type, childOffset);
|
||||||
const ColorNumberToolTip colorNumberNamePair((*colorNumberIn)++, toolTip);
|
const ColorNumberToolTip colorNumberNamePair((*colorNumberIn)++, toolTip);
|
||||||
const ColorNumberToolTips::iterator begin = cnmv->begin() + childOffset;
|
const ColorNumberToolTips::iterator begin = cnmv->begin() + childOffset;
|
||||||
qFill(begin, begin + item->size, colorNumberNamePair);
|
std::fill(begin, begin + item->size, colorNumberNamePair);
|
||||||
childCount++;
|
childCount++;
|
||||||
childCount += memberVariableRecursion(child, childName, start, end, colorNumberIn, cnmv);
|
childCount += memberVariableRecursion(child, childName, start, end, colorNumberIn, cnmv);
|
||||||
}
|
}
|
||||||
|
@@ -78,6 +78,8 @@
|
|||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
static const char settingsGroupC[] = "Designer";
|
static const char settingsGroupC[] = "Designer";
|
||||||
|
|
||||||
/* Actions of the designer plugin:
|
/* Actions of the designer plugin:
|
||||||
@@ -249,8 +251,8 @@ FormEditorData::FormEditorData() :
|
|||||||
QTC_ASSERT(!d, return);
|
QTC_ASSERT(!d, return);
|
||||||
d = this;
|
d = this;
|
||||||
|
|
||||||
qFill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount,
|
std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount,
|
||||||
static_cast<QWidget *>(0));
|
static_cast<QWidget *>(0));
|
||||||
|
|
||||||
m_formeditor->setTopLevel(ICore::mainWindow());
|
m_formeditor->setTopLevel(ICore::mainWindow());
|
||||||
m_formeditor->setSettingsManager(new SettingsManager());
|
m_formeditor->setSettingsManager(new SettingsManager());
|
||||||
@@ -449,7 +451,7 @@ void FormEditorData::fullInit()
|
|||||||
|
|
||||||
void FormEditorData::initDesignerSubWindows()
|
void FormEditorData::initDesignerSubWindows()
|
||||||
{
|
{
|
||||||
qFill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(0));
|
std::fill(m_designerSubWindows, m_designerSubWindows + DesignerSubWindowCount, static_cast<QWidget*>(0));
|
||||||
|
|
||||||
QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, 0);
|
QDesignerWidgetBoxInterface *wb = QDesignerComponents::createWidgetBox(m_formeditor, 0);
|
||||||
wb->setWindowTitle(tr("Widget Box"));
|
wb->setWindowTitle(tr("Widget Box"));
|
||||||
|
@@ -640,9 +640,9 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
|||||||
approval.description = ao.value(approvalsDescriptionKey).toString();
|
approval.description = ao.value(approvalsDescriptionKey).toString();
|
||||||
change->currentPatchSet.approvals.push_back(approval);
|
change->currentPatchSet.approvals.push_back(approval);
|
||||||
}
|
}
|
||||||
qStableSort(change->currentPatchSet.approvals.begin(),
|
std::stable_sort(change->currentPatchSet.approvals.begin(),
|
||||||
change->currentPatchSet.approvals.end(),
|
change->currentPatchSet.approvals.end(),
|
||||||
gerritApprovalLessThan);
|
gerritApprovalLessThan);
|
||||||
// Remaining
|
// Remaining
|
||||||
change->number = object.value(numberKey).toString().toInt();
|
change->number = object.value(numberKey).toString().toInt();
|
||||||
change->url = object.value(urlKey).toString();
|
change->url = object.value(urlKey).toString();
|
||||||
@@ -779,7 +779,7 @@ void GerritModel::queryFinished(const QByteArray &output)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sort by depth (root nodes first) and by date.
|
// Sort by depth (root nodes first) and by date.
|
||||||
qStableSort(changes.begin(), changes.end(), gerritChangeLessThan);
|
std::stable_sort(changes.begin(), changes.end(), gerritChangeLessThan);
|
||||||
numberIndexHash.clear();
|
numberIndexHash.clear();
|
||||||
|
|
||||||
foreach (const GerritChangePtr &c, changes) {
|
foreach (const GerritChangePtr &c, changes) {
|
||||||
|
@@ -269,9 +269,8 @@ void KitManager::registerKitInformation(KitInformation *ki)
|
|||||||
QTC_CHECK(!isLoaded());
|
QTC_CHECK(!isLoaded());
|
||||||
QTC_ASSERT(!d->m_informationList.contains(ki), return);
|
QTC_ASSERT(!d->m_informationList.contains(ki), return);
|
||||||
|
|
||||||
QList<KitInformation *>::iterator it
|
auto it = std::lower_bound(d->m_informationList.begin(), d->m_informationList.end(),
|
||||||
= qLowerBound(d->m_informationList.begin(),
|
ki, greaterPriority);
|
||||||
d->m_informationList.end(), ki, greaterPriority);
|
|
||||||
d->m_informationList.insert(it, ki);
|
d->m_informationList.insert(it, ki);
|
||||||
|
|
||||||
if (!isLoaded())
|
if (!isLoaded())
|
||||||
|
@@ -869,7 +869,7 @@ void FlatModel::changedSortKey(FolderNode *folderNode, Node *node)
|
|||||||
int oldIndex = nodes.indexOf(node);
|
int oldIndex = nodes.indexOf(node);
|
||||||
|
|
||||||
nodes.removeAt(oldIndex);
|
nodes.removeAt(oldIndex);
|
||||||
QList<Node *>::iterator newPosIt = qLowerBound(nodes.begin(), nodes.end(), node, sortNodes);
|
QList<Node *>::iterator newPosIt = std::lower_bound(nodes.begin(), nodes.end(), node, sortNodes);
|
||||||
int newIndex = newPosIt - nodes.begin();
|
int newIndex = newPosIt - nodes.begin();
|
||||||
|
|
||||||
if (newIndex == oldIndex)
|
if (newIndex == oldIndex)
|
||||||
|
@@ -370,7 +370,7 @@ void FolderNode::addFileNodes(const QList<FileNode *> &files)
|
|||||||
// empty list or greater then last node
|
// empty list or greater then last node
|
||||||
m_fileNodes.append(file);
|
m_fileNodes.append(file);
|
||||||
} else {
|
} else {
|
||||||
auto it = qLowerBound(m_fileNodes.begin(), m_fileNodes.end(), file);
|
auto it = std::lower_bound(m_fileNodes.begin(), m_fileNodes.end(), file);
|
||||||
m_fileNodes.insert(it, file);
|
m_fileNodes.insert(it, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,7 +438,7 @@ void FolderNode::addFolderNodes(const QList<FolderNode*> &subFolders)
|
|||||||
m_subFolderNodes.append(folder);
|
m_subFolderNodes.append(folder);
|
||||||
} else {
|
} else {
|
||||||
// Binary Search for insertion point
|
// Binary Search for insertion point
|
||||||
auto it = qLowerBound(m_subFolderNodes.begin(), m_subFolderNodes.end(), folder);
|
auto it = std::lower_bound(m_subFolderNodes.begin(), m_subFolderNodes.end(), folder);
|
||||||
m_subFolderNodes.insert(it, folder);
|
m_subFolderNodes.insert(it, folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -106,7 +108,7 @@ void TaskModel::addTask(const Task &task)
|
|||||||
CategoryData &data = m_categories[task.category];
|
CategoryData &data = m_categories[task.category];
|
||||||
CategoryData &global = m_categories[Core::Id()];
|
CategoryData &global = m_categories[Core::Id()];
|
||||||
|
|
||||||
auto it = qLowerBound(m_tasks.begin(), m_tasks.end(),task.taskId, sortById);
|
auto it = std::lower_bound(m_tasks.begin(), m_tasks.end(),task.taskId, sortById);
|
||||||
int i = it - m_tasks.begin();
|
int i = it - m_tasks.begin();
|
||||||
beginInsertRows(QModelIndex(), i, i);
|
beginInsertRows(QModelIndex(), i, i);
|
||||||
m_tasks.insert(it, task);
|
m_tasks.insert(it, task);
|
||||||
@@ -131,7 +133,7 @@ void TaskModel::removeTask(const Task &task)
|
|||||||
|
|
||||||
int TaskModel::rowForId(unsigned int id)
|
int TaskModel::rowForId(unsigned int id)
|
||||||
{
|
{
|
||||||
auto it = qLowerBound(m_tasks.constBegin(), m_tasks.constEnd(), id, sortById);
|
auto it = std::lower_bound(m_tasks.constBegin(), m_tasks.constEnd(), id, sortById);
|
||||||
if (it == m_tasks.constEnd())
|
if (it == m_tasks.constEnd())
|
||||||
return -1;
|
return -1;
|
||||||
return it - m_tasks.constBegin();
|
return it - m_tasks.constBegin();
|
||||||
@@ -374,8 +376,8 @@ QVariant TaskFilterModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
static QPair<int, int> findFilteredRange(int first, int last, const QList<int> &list)
|
static QPair<int, int> findFilteredRange(int first, int last, const QList<int> &list)
|
||||||
{
|
{
|
||||||
auto filteredFirst = qLowerBound(list, first);
|
auto filteredFirst = std::lower_bound(list.constBegin(), list.constEnd(), first);
|
||||||
auto filteredLast = qUpperBound(filteredFirst, list.constEnd(), last);
|
auto filteredLast = std::upper_bound(filteredFirst, list.constEnd(), last);
|
||||||
return qMakePair(filteredFirst - list.constBegin(), filteredLast - list.constBegin() - 1);
|
return qMakePair(filteredFirst - list.constBegin(), filteredLast - list.constBegin() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +401,7 @@ void TaskFilterModel::handleNewRows(const QModelIndex &index, int first, int las
|
|||||||
if (last == m_sourceModel->rowCount() - 1)
|
if (last == m_sourceModel->rowCount() - 1)
|
||||||
filteredFirst = m_mapping.count();
|
filteredFirst = m_mapping.count();
|
||||||
else
|
else
|
||||||
filteredFirst = qLowerBound(m_mapping, first) - m_mapping.constBegin();
|
filteredFirst = std::lower_bound(m_mapping.constBegin(), m_mapping.constEnd(), first) - m_mapping.constBegin();
|
||||||
|
|
||||||
const int filteredLast = filteredFirst + newItems - 1;
|
const int filteredLast = filteredFirst + newItems - 1;
|
||||||
beginInsertRows(QModelIndex(), filteredFirst, filteredLast);
|
beginInsertRows(QModelIndex(), filteredFirst, filteredLast);
|
||||||
@@ -449,8 +451,8 @@ void TaskFilterModel::handleReset()
|
|||||||
|
|
||||||
QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const
|
QModelIndex TaskFilterModel::mapFromSource(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
auto it = qBinaryFind(m_mapping.constBegin(), m_mapping.constEnd(), idx.row());
|
auto it = std::lower_bound(m_mapping.constBegin(), m_mapping.constEnd(), idx.row());
|
||||||
if (it == m_mapping.constEnd())
|
if (it == m_mapping.constEnd() || idx.row() != *it)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
return index(it - m_mapping.constBegin(), 0);
|
return index(it - m_mapping.constBegin(), 0);
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -568,7 +569,7 @@ static inline QList<IOptionsPage*> sortedOptionsPages()
|
|||||||
static PropertyNameList sortedPropertyNameList(const PropertyNameList &nameList)
|
static PropertyNameList sortedPropertyNameList(const PropertyNameList &nameList)
|
||||||
{
|
{
|
||||||
PropertyNameList sortedPropertyNameList = nameList;
|
PropertyNameList sortedPropertyNameList = nameList;
|
||||||
qStableSort(sortedPropertyNameList);
|
std::stable_sort(sortedPropertyNameList.begin(), sortedPropertyNameList.end());
|
||||||
return sortedPropertyNameList;
|
return sortedPropertyNameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,8 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using Core::ICore;
|
using Core::ICore;
|
||||||
using ProjectExplorer::ProjectExplorerPlugin;
|
using ProjectExplorer::ProjectExplorerPlugin;
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ void QmlProjectRunConfigurationWidget::updateFileComboBox()
|
|||||||
}
|
}
|
||||||
sortedFiles = relativeFiles;
|
sortedFiles = relativeFiles;
|
||||||
|
|
||||||
qStableSort(sortedFiles.begin(), sortedFiles.end(), caseInsensitiveLessThan);
|
std::stable_sort(sortedFiles.begin(), sortedFiles.end(), caseInsensitiveLessThan);
|
||||||
|
|
||||||
QString mainScriptPath;
|
QString mainScriptPath;
|
||||||
if (m_runConfiguration->mainScriptSource() != QmlProjectRunConfiguration::FileInEditor)
|
if (m_runConfiguration->mainScriptSource() != QmlProjectRunConfiguration::FileInEditor)
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
@@ -51,12 +53,12 @@ Keywords::Keywords(const QStringList &variabels, const QStringList &functions, c
|
|||||||
|
|
||||||
bool Keywords::isVariable(const QString &word) const
|
bool Keywords::isVariable(const QString &word) const
|
||||||
{
|
{
|
||||||
return qBinaryFind(m_variables, word) != m_variables.constEnd();
|
return std::binary_search(m_variables.constBegin(), m_variables.constEnd(), word);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keywords::isFunction(const QString &word) const
|
bool Keywords::isFunction(const QString &word) const
|
||||||
{
|
{
|
||||||
return qBinaryFind(m_functions, word) != m_functions.constEnd();
|
return std::binary_search(m_functions.constBegin(), m_functions.constEnd(), word);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Keywords::variables() const
|
QStringList Keywords::variables() const
|
||||||
|
Reference in New Issue
Block a user