mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Replace deprecated Qt algorithms with C++ Standard Library equivalents
This commit is contained in:
parent
86fb68f305
commit
314d8a645b
@ -2279,7 +2279,7 @@ void Configuration::impl::delete_selected_macros (QModelIndexList selected_rows)
|
||||
{
|
||||
// sort in reverse row order so that we can delete without changing
|
||||
// indices underneath us
|
||||
qSort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
std::sort (selected_rows.begin (), selected_rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return rhs.row () < lhs.row (); // reverse row ordering
|
||||
});
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QAbstractTableModel>
|
||||
@ -350,14 +351,6 @@ bool FrequencyList_v2::remove (Item f)
|
||||
return m_->removeRow (row);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return lhs.row () > rhs.row ();
|
||||
}
|
||||
}
|
||||
|
||||
bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows)
|
||||
{
|
||||
bool result {true};
|
||||
@ -371,7 +364,10 @@ bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows)
|
||||
}
|
||||
|
||||
// reverse sort by row
|
||||
qSort (rows.begin (), rows.end (), row_is_higher);
|
||||
std::sort (rows.begin (), rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return rhs.row () < lhs.row (); // reverse row ordering
|
||||
});
|
||||
Q_FOREACH (auto index, rows)
|
||||
{
|
||||
if (result && !m_->removeRow (index.row ()))
|
||||
|
@ -139,14 +139,6 @@ bool StationList::remove (Station s)
|
||||
return removeRow (row);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool row_is_higher (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return lhs.row () > rhs.row ();
|
||||
}
|
||||
}
|
||||
|
||||
bool StationList::removeDisjointRows (QModelIndexList rows)
|
||||
{
|
||||
bool result {true};
|
||||
@ -160,7 +152,10 @@ bool StationList::removeDisjointRows (QModelIndexList rows)
|
||||
}
|
||||
|
||||
// reverse sort by row
|
||||
qSort (rows.begin (), rows.end (), row_is_higher);
|
||||
std::sort (rows.begin (), rows.end (), [] (QModelIndex const& lhs, QModelIndex const& rhs)
|
||||
{
|
||||
return rhs.row () < lhs.row (); // reverse row ordering
|
||||
});
|
||||
Q_FOREACH (auto index, rows)
|
||||
{
|
||||
if (result && !m_->removeRow (index.row ()))
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <functional>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <fftw3.h>
|
||||
#include <QLineEdit>
|
||||
#include <QRegExpValidator>
|
||||
@ -7923,9 +7924,9 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
|
||||
|
||||
if(isort>1) {
|
||||
if(bReverse) {
|
||||
qSort(list.begin(),list.end(),qGreater<int>());
|
||||
std::sort (list.begin (), list.end (), std::greater<int> ());
|
||||
} else {
|
||||
qSort(list.begin(),list.end());
|
||||
std::sort (list.begin (), list.end ());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user