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