refactor: replace qSort with std::sort

This commit is contained in:
fanquake 2019-08-21 09:44:19 +08:00
parent fea33cbbdf
commit 59373e3e94
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
2 changed files with 6 additions and 2 deletions

View file

@ -10,6 +10,8 @@
#include <key_io.h>
#include <wallet/wallet.h>
#include <algorithm>
#include <QFont>
#include <QDebug>
@ -89,7 +91,7 @@ public:
// qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
// Even though the map is already sorted this re-sorting step is needed because the originating map
// is sorted by binary address, not by base58() address.
qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
std::sort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
}
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)

View file

@ -11,6 +11,8 @@
#include <clientversion.h>
#include <streams.h>
#include <algorithm>
RecentRequestsTableModel::RecentRequestsTableModel(WalletModel *parent) :
QAbstractTableModel(parent), walletModel(parent)
@ -202,7 +204,7 @@ void RecentRequestsTableModel::addNewRequest(RecentRequestEntry &recipient)
void RecentRequestsTableModel::sort(int column, Qt::SortOrder order)
{
qSort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order));
std::sort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order));
Q_EMIT dataChanged(index(0, 0, QModelIndex()), index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex()));
}