Replace deprecated Qt algorithms with C++ Standard Library equivalents

This commit is contained in:
Bill Somerville
2018-11-25 22:13:15 +00:00
parent 86fb68f305
commit 314d8a645b
4 changed files with 16 additions and 24 deletions
+4 -9
View File
@@ -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 ()))