summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-09-24 10:17:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-25 11:48:14 +0200
commita64ab5ec4042ed898272c960396005b525fd68e9 (patch)
treeef7d2fcc7447fce1f7c45c87885c275f7989bd52
parentb81b952f1c41c1ab5292fdf68c7e3436075954b7 (diff)
downloadqttools-a64ab5ec4042ed898272c960396005b525fd68e9.tar.gz
Remove QtAlgorithms usage from Qt Designer.
QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I2c7057557295a9bbc83b3d7c625b04400d9e6c2a Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.cpp4
-rw-r--r--src/designer/src/components/formeditor/widgetselection.cpp6
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp4
-rw-r--r--src/designer/src/lib/shared/layout.cpp20
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp12
-rw-r--r--src/designer/src/lib/shared/rcc.cpp6
-rw-r--r--src/shared/findwidget/itemviewfindwidget.cpp4
7 files changed, 35 insertions, 21 deletions
diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.cpp b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
index 51e59f7b2..25d31d9aa 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.cpp
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
@@ -67,6 +67,8 @@
#include <QtCore/QSet>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
@@ -276,7 +278,7 @@ void EmbeddedOptionsControlPrivate::sortAndPopulateProfileCombo()
for (int i = m_profileCombo->count() - 1; i > 0; i--)
m_profileCombo->removeItem(i);
if (!m_sortedProfiles.empty()) {
- qSort(m_sortedProfiles.begin(), m_sortedProfiles.end(), deviceProfileLessThan);
+ std::sort(m_sortedProfiles.begin(), m_sortedProfiles.end(), deviceProfileLessThan);
m_profileCombo->addItems(existingProfileNames());
}
}
diff --git a/src/designer/src/components/formeditor/widgetselection.cpp b/src/designer/src/components/formeditor/widgetselection.cpp
index dd1d2adc0..4795042b3 100644
--- a/src/designer/src/components/formeditor/widgetselection.cpp
+++ b/src/designer/src/components/formeditor/widgetselection.cpp
@@ -67,6 +67,8 @@
#include <QtCore/QVariant>
#include <QtCore/qdebug.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
@@ -599,11 +601,11 @@ void WidgetSelection::updateActive()
{
const WidgetState ws = widgetState(m_formWindow->core(), m_widget);
bool active[WidgetHandle::TypeCount];
- qFill(active, active + WidgetHandle::TypeCount, false);
+ std::fill(active, active + WidgetHandle::TypeCount, false);
// Determine active handles
switch (ws) {
case UnlaidOut:
- qFill(active, active + WidgetHandle::TypeCount, true);
+ std::fill(active, active + WidgetHandle::TypeCount, true);
break;
case ManagedGridLayout: // Grid: Allow changing span
active[WidgetHandle::Left] = active[WidgetHandle::Top] = active[WidgetHandle::Right] = active[WidgetHandle::Bottom] = true;
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
index b0975d274..cee8e5215 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -62,6 +62,8 @@
#include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
namespace {
@@ -311,7 +313,7 @@ namespace qdesigner_internal {
QObjectList children = object->children();
if (!children.empty()) {
ButtonGroupList buttonGroups;
- qSort(children.begin(), children.end(), sortEntry);
+ std::sort(children.begin(), children.end(), sortEntry);
const QObjectList::const_iterator cend = children.constEnd();
for (QObjectList::const_iterator it = children.constBegin(); it != cend; ++it) {
// Managed child widgets unless we had a container extension
diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp
index 9f1ae8273..fd4a60922 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -73,6 +73,8 @@
#include <QtCore/QDebug>
#include <QtCore/QSet>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
enum { FormLayoutColumns = 2 };
@@ -518,7 +520,7 @@ BoxLayout::BoxLayout(const QWidgetList &wl, QWidget *p, QDesignerFormWindowInter
void BoxLayout::sort()
{
QWidgetList wl = widgets();
- qStableSort(wl.begin(), wl.end(), PositionSortPredicate(m_orientation));
+ std::stable_sort(wl.begin(), wl.end(), PositionSortPredicate(m_orientation));
setWidgets(wl);
}
@@ -571,7 +573,7 @@ SplitterLayout::SplitterLayout(const QWidgetList &wl, QWidget *p, QDesignerFormW
void SplitterLayout::sort()
{
QWidgetList wl = widgets();
- qStableSort(wl.begin(), wl.end(), PositionSortPredicate(m_orientation));
+ std::stable_sort(wl.begin(), wl.end(), PositionSortPredicate(m_orientation));
setWidgets(wl);
}
@@ -674,7 +676,7 @@ void Grid::resize(int nrows, int ncols)
m_ncols = ncols;
if (const int allocSize = m_nrows * m_ncols) {
m_cells = new QWidget*[allocSize];
- qFill(m_cells, m_cells + allocSize, static_cast<QWidget *>(0));
+ std::fill(m_cells, m_cells + allocSize, static_cast<QWidget *>(0));
}
}
@@ -707,7 +709,7 @@ void Grid::setCells(const QRect &c, QWidget* w)
for (int r = c.top(); r < bottom; r++) {
QWidget **pos = m_cells + r * m_ncols + c.left();
- qFill(pos, pos + width, w);
+ std::fill(pos, pos + width, w);
}
}
@@ -962,7 +964,7 @@ void Grid::shrink()
return;
// reallocate and copy omitting the empty cells
QWidget **simplifiedCells = new QWidget*[simplifiedNCols * simplifiedNRows];
- qFill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, static_cast<QWidget *>(0));
+ std::fill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, static_cast<QWidget *>(0));
QWidget **simplifiedPtr = simplifiedCells;
for (int r = 0; r < m_nrows; r++)
@@ -1061,7 +1063,7 @@ void Grid::reallocFormLayout()
// Reallocate with 2 columns. Just insert the protruding ones as fields.
const int formNRows = m_nrows + pastRightWidgetCount;
QWidget **formCells = new QWidget*[FormLayoutColumns * formNRows];
- qFill(formCells, formCells + FormLayoutColumns * formNRows, static_cast<QWidget *>(0));
+ std::fill(formCells, formCells + FormLayoutColumns * formNRows, static_cast<QWidget *>(0));
QWidget **formPtr = formCells;
const int matchingColumns = qMin(m_ncols, static_cast<int>(FormLayoutColumns));
for (int r = 0; r < m_nrows; r++) {
@@ -1086,7 +1088,7 @@ void Grid::reallocFormLayout()
bool Grid::locateWidget(QWidget *w, int &row, int &col, int &rowspan, int &colspan) const
{
const int end = m_nrows * m_ncols;
- const int startIndex = qFind(m_cells, m_cells + end, w) - m_cells;
+ const int startIndex = std::find(m_cells, m_cells + end, w) - m_cells;
if (startIndex == end)
return false;
@@ -1218,8 +1220,8 @@ QWidgetList GridLayout<GridLikeLayout, LayoutType, GridMode>::buildGrid(const QW
index += 2;
}
- qSort(x);
- qSort(y);
+ std::sort(x.begin(), x.end());
+ std::sort(y.begin(), y.end());
// Remove duplicate x entries (Remove next, if equal to current)
removeIntVecDuplicates(x);
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index 23c6885ee..de7769cb2 100644
--- a/src/designer/src/lib/shared/qlayout_widget.cpp
+++ b/src/designer/src/lib/shared/qlayout_widget.cpp
@@ -67,6 +67,8 @@
#include <QtCore/QPair>
#include <QtCore/QSet>
+#include <algorithm>
+
enum { ShiftValue = 1 };
enum { debugLayout = 0 };
enum { FormLayoutColumns = 2 };
@@ -238,7 +240,7 @@ static bool removeEmptyCellsOnGrid(GridLikeLayout *grid, const QRect &area)
}
// remove, starting from last
if (!indexesToBeRemoved.empty()) {
- qStableSort(indexesToBeRemoved.begin(), indexesToBeRemoved.end());
+ std::stable_sort(indexesToBeRemoved.begin(), indexesToBeRemoved.end());
for (int i = indexesToBeRemoved.size() - 1; i >= 0; i--)
delete grid->takeAt(indexesToBeRemoved[i]);
}
@@ -255,10 +257,10 @@ LayoutProperties::LayoutProperties()
void LayoutProperties::clear()
{
- qFill(m_margins, m_margins + MarginCount, 0);
- qFill(m_marginsChanged, m_marginsChanged + MarginCount, false);
- qFill(m_spacings, m_spacings + SpacingsCount, 0);
- qFill(m_spacingsChanged, m_spacingsChanged + SpacingsCount, false);
+ std::fill(m_margins, m_margins + MarginCount, 0);
+ std::fill(m_marginsChanged, m_marginsChanged + MarginCount, false);
+ std::fill(m_spacings, m_spacings + SpacingsCount, 0);
+ std::fill(m_spacingsChanged, m_spacingsChanged + SpacingsCount, false);
m_objectName = QVariant();
m_objectNameChanged = false;
diff --git a/src/designer/src/lib/shared/rcc.cpp b/src/designer/src/lib/shared/rcc.cpp
index 606c2209c..88b4483c2 100644
--- a/src/designer/src/lib/shared/rcc.cpp
+++ b/src/designer/src/lib/shared/rcc.cpp
@@ -54,6 +54,8 @@
#include <QtCore/QStack>
#include <QtCore/QXmlStreamReader>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
enum {
@@ -907,7 +909,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values();
- qSort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
//write out the actual data now
for (int i = 0; i < m_children.size(); ++i) {
@@ -926,7 +928,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values();
- qSort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
//write out the actual data now
for (int i = 0; i < m_children.size(); ++i) {
diff --git a/src/shared/findwidget/itemviewfindwidget.cpp b/src/shared/findwidget/itemviewfindwidget.cpp
index bdd36aa33..84e5c6db0 100644
--- a/src/shared/findwidget/itemviewfindwidget.cpp
+++ b/src/shared/findwidget/itemviewfindwidget.cpp
@@ -68,6 +68,8 @@
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QTreeView>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
/*!
@@ -179,7 +181,7 @@ void ItemViewFindWidget::find(const QString &ttf, bool skipCurrent, bool backwar
QModelIndex idx;
if (skipCurrent && m_itemView->selectionModel()->hasSelection()) {
QModelIndexList il = m_itemView->selectionModel()->selectedIndexes();
- qSort(il.begin(), il.end(), indexLessThan);
+ std::sort(il.begin(), il.end(), indexLessThan);
idx = backward ? il.first() : il.last();
} else {
idx = m_itemView->currentIndex();