Remove deprecated algorithms usage from itemviews
QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I68efdd1b08b94a737345644a5b588ffff5caac63 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
parent
1a844db508
commit
d757b5251f
@ -304,7 +304,7 @@ void QListModel::sort(int column, Qt::SortOrder order)
|
||||
}
|
||||
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qSort(sorting.begin(), sorting.end(), compare);
|
||||
std::sort(sorting.begin(), sorting.end(), compare);
|
||||
QModelIndexList fromIndexes;
|
||||
QModelIndexList toIndexes;
|
||||
for (int r = 0; r < sorting.count(); ++r) {
|
||||
@ -338,7 +338,7 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en
|
||||
}
|
||||
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qSort(sorting.begin(), sorting.end(), compare);
|
||||
std::sort(sorting.begin(), sorting.end(), compare);
|
||||
|
||||
QModelIndexList oldPersistentIndexes = persistentIndexList();
|
||||
QModelIndexList newPersistentIndexes = oldPersistentIndexes;
|
||||
@ -1832,7 +1832,7 @@ void QListWidget::dropEvent(QDropEvent *event) {
|
||||
|
||||
if (persIndexes.contains(topIndex))
|
||||
return;
|
||||
qSort(persIndexes); // The dropped items will remain in the same visual order.
|
||||
std::sort(persIndexes.begin(), persIndexes.end()); // The dropped items will remain in the same visual order.
|
||||
|
||||
QPersistentModelIndex dropRow = model()->index(row, col, topIndex);
|
||||
|
||||
|
@ -510,7 +510,7 @@ void QTableModel::sort(int column, Qt::SortOrder order)
|
||||
}
|
||||
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qStableSort(sortable.begin(), sortable.end(), compare);
|
||||
std::stable_sort(sortable.begin(), sortable.end(), compare);
|
||||
|
||||
QVector<QTableWidgetItem*> sorted_table(tableItems.count());
|
||||
QModelIndexList from;
|
||||
@ -558,7 +558,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
|
||||
}
|
||||
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qStableSort(sorting.begin(), sorting.end(), compare);
|
||||
std::stable_sort(sorting.begin(), sorting.end(), compare);
|
||||
|
||||
QModelIndexList oldPersistentIndexes = persistentIndexList();
|
||||
QModelIndexList newPersistentIndexes = oldPersistentIndexes;
|
||||
|
@ -61,6 +61,8 @@
|
||||
#include <private/qtreeview_p.h>
|
||||
#include <private/qheaderview_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
@ -3758,7 +3760,7 @@ QList<QPair<int, int> > QTreeViewPrivate::columnRanges(const QModelIndex &topInd
|
||||
}
|
||||
}
|
||||
//let's sort the list
|
||||
qSort(logicalIndexes.begin(), logicalIndexes.end());
|
||||
std::sort(logicalIndexes.begin(), logicalIndexes.end());
|
||||
|
||||
QList<QPair<int, int> > ret;
|
||||
QPair<int, int> current;
|
||||
|
@ -614,7 +614,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
|
||||
}
|
||||
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qStableSort(sorting.begin(), sorting.end(), compare);
|
||||
std::stable_sort(sorting.begin(), sorting.end(), compare);
|
||||
|
||||
QModelIndexList oldPersistentIndexes;
|
||||
QModelIndexList newPersistentIndexes;
|
||||
@ -854,7 +854,7 @@ void QTreeModel::sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortO
|
||||
|
||||
// do the sorting
|
||||
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
|
||||
qStableSort(sorting.begin(), sorting.end(), compare);
|
||||
std::stable_sort(sorting.begin(), sorting.end(), compare);
|
||||
|
||||
QModelIndexList fromList;
|
||||
QModelIndexList toList;
|
||||
|
Loading…
Reference in New Issue
Block a user