From e3d43b5696d9aede430594fd4304d54d80bd7fac Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 3 Apr 2019 20:21:53 +0200 Subject: [PATCH] replace deprecated qSort() with std::sort() Signed-off-by: Rolf Eike Beer --- core/downloadfromdcthread.cpp | 8 +++++--- core/qthelper.cpp | 2 +- desktop-widgets/divelistview.cpp | 2 +- desktop-widgets/preferences/preferencesdialog.cpp | 2 +- desktop-widgets/printoptions.cpp | 2 +- qt-models/divelocationmodel.cpp | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index e2db8b66e..03268a0f0 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -184,8 +184,10 @@ void fill_computer_list() descriptorLookup[QString(vendor) + QString(product)] = descriptor; } dc_iterator_free(iterator); - Q_FOREACH (QString vendor, vendorList) - qSort(productList[vendor]); + Q_FOREACH (QString vendor, vendorList) { + auto &l = productList[vendor]; + std::sort(l.begin(), l.end()); + } #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) /* currently suppress the Uemis Zurich on Q_OS_ANDROID and Q_OS_IOS, @@ -212,7 +214,7 @@ void fill_computer_list() descriptorLookup["UemisZurich"] = (dc_descriptor_t *)mydescriptor; #endif - qSort(vendorList); + std::sort(vendorList.begin(), vendorList.end()); } #define NUMTRANSPORTS 7 diff --git a/core/qthelper.cpp b/core/qthelper.cpp index b3bf23691..35965208c 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -394,7 +394,7 @@ void selectedDivesGasUsed(QVector > &gasUsedOrdered) Q_FOREACH(const QString& gas, gasUsed.keys()) { gasUsedOrdered.append(qMakePair(gas, gasUsed[gas])); } - qSort(gasUsedOrdered.begin(), gasUsedOrdered.end(), lessThan); + std::sort(gasUsedOrdered.begin(), gasUsedOrdered.end(), lessThan); } QString getUserAgent() diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 3ba9ba58f..086bc0a6d 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -402,7 +402,7 @@ void DiveListView::selectDives(const QList &newDiveSelection) // select the dives, highest index first - this way the oldest of the dives // becomes the selected_dive that we scroll to QList sortedSelection = newDiveSelection; - qSort(sortedSelection.begin(), sortedSelection.end()); + std::sort(sortedSelection.begin(), sortedSelection.end()); newSelection = firstInList = sortedSelection.first(); while (!sortedSelection.isEmpty()) diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index 59dbdf59b..fbf387cfa 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -97,7 +97,7 @@ bool abstractpreferenceswidget_lessthan(AbstractPreferencesWidget *p1, AbstractP void PreferencesDialog::addPreferencePage(AbstractPreferencesWidget *page) { pages.push_back(page); - qSort(pages.begin(), pages.end(), abstractpreferenceswidget_lessthan); + std::sort(pages.begin(), pages.end(), abstractpreferenceswidget_lessthan); } void PreferencesDialog::refreshPages() diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp index 38a670cf8..0d9ae0a40 100644 --- a/desktop-widgets/printoptions.cpp +++ b/desktop-widgets/printoptions.cpp @@ -56,7 +56,7 @@ void PrintOptions::setupTemplates() // temp. store the template from options, as addItem() updates it via: // on_printTemplate_currentIndexChanged() QString storedTemplate = printOptions->p_template; - qSort(currList); + currList.sort(); int current_index = 0; ui.printTemplate->clear(); Q_FOREACH(const QString& theme, currList) { diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index b84604bb5..a942961a5 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -77,7 +77,7 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons void LocationInformationModel::update() { beginResetModel(); - qSort(dive_site_table.dive_sites, dive_site_table.dive_sites + dive_site_table.nr, dive_site_less_than); + std::sort(dive_site_table.dive_sites, dive_site_table.dive_sites + dive_site_table.nr, dive_site_less_than); locationNames.clear(); for (int i = 0; i < dive_site_table.nr; i++) locationNames << QString(dive_site_table.dive_sites[i]->name);