A new user interface for you! Read more...

File 0001-Revert-replace-obsolete-qSort-function.patch of Package digikam

From 87d90549a5db7c309228697652a4608ee774be74 Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Sun, 14 Jan 2018 00:17:04 +0100
Subject: [PATCH] Revert "replace obsolete qSort() function"

This reverts commit 1fdff40d7efaf9ab9d8fe716970e02a18bdb73f7.
It breaks compilation with GCC 4.8.
---
 app/utils/tooltipfiller.cpp                        |  2 +-
 app/views/tableview/tableview_model.cpp            |  6 ++--
 libs/album/albummanager.cpp                        |  6 ++--
 libs/database/collection/collectionscanner.cpp     |  2 +-
 .../imagehistory/imagehistorygraph_boost.h         |  2 +-
 .../imagehistory/imagehistorygraphmodel.cpp        |  2 +-
 libs/database/models/imagemodel.cpp                |  2 +-
 libs/database/tags/facetags.cpp                    |  2 +-
 libs/dimg/imagehistory/dimagehistory.cpp           |  2 +-
 libs/dmetadata/dmetadatasettingscontainer.cpp      |  2 +-
 libs/dtrash/dtrashitemmodel.cpp                    | 32 +++++++++++-----------
 libs/imageproperties/disjointmetadata.cpp          |  2 +-
 libs/tags/tagfolderview.cpp                        | 18 ++++++------
 libs/tags/tagsmanager/tagmngrtreeview.cpp          | 10 +++----
 libs/widgets/fonts/dfontproperties.cpp             |  4 +--
 libs/widgets/iccprofiles/iccprofilescombobox.cpp   |  2 +-
 showfoto/thumbbar/showfotoimagemodel.cpp           |  2 +-
 tests/dimg/dimghistorygraphtest.cpp                | 18 ++++++------
 utilities/advancedrename/advancedrenamemanager.cpp |  6 ++--
 .../editor/correlator/track_correlator_thread.cpp  |  2 +-
 .../editor/searches/searchresultmodel.cpp          |  4 +--
 .../geolocation/geoiface/tracks/trackreader.cpp    |  2 +-
 utilities/importui/models/importimagemodel.cpp     |  2 +-
 utilities/maintenance/imageinfojob.cpp             |  2 +-
 utilities/searchwindow/searchutilities.cpp         |  6 ++--
 25 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/core/app/utils/tooltipfiller.cpp b/core/app/utils/tooltipfiller.cpp
index 0371cdfe73..e40cefd18f 100644
--- a/core/app/utils/tooltipfiller.cpp
+++ b/core/app/utils/tooltipfiller.cpp
@@ -677,7 +677,7 @@ QString ToolTipFiller::filterActionTipContents(const FilterAction& action)
 
         const QHash<QString, QVariant>& params = action.parameters();
         QList<QString> keys                    = params.keys();
-        std::sort(keys.begin(), keys.end());
+        qSort(keys);
 
         foreach(const QString& key, keys)
         {
diff --git a/core/app/views/tableview/tableview_model.cpp b/core/app/views/tableview/tableview_model.cpp
index 6047462023..f168f577f1 100644
--- a/core/app/views/tableview/tableview_model.cpp
+++ b/core/app/views/tableview/tableview_model.cpp
@@ -1144,9 +1144,9 @@ QList<TableViewModel::Item*> TableViewModel::sortItems(const QList<TableViewMode
 {
     QList<Item*> sortedList = itemList;
 
-    std::sort(sortedList.begin(),
-              sortedList.end(),
-              LessThan(this));
+    qSort(sortedList.begin(),
+          sortedList.end(),
+          LessThan(this));
 
     return sortedList;
 }
diff --git a/core/libs/album/albummanager.cpp b/core/libs/album/albummanager.cpp
index ea0726eab3..f41f3faeac 100644
--- a/core/libs/album/albummanager.cpp
+++ b/core/libs/album/albummanager.cpp
@@ -1290,7 +1290,7 @@ void AlbumManager::scanPAlbums()
     QList<AlbumInfo> currentAlbums = CoreDbAccess().db()->scanAlbums();
 
     // sort by relative path so that parents are created before children
-    std::sort(currentAlbums.begin(), currentAlbums.end());
+    qSort(currentAlbums);
 
     QList<AlbumInfo> newAlbums;
 
@@ -1342,7 +1342,7 @@ void AlbumManager::scanPAlbums()
     }
 
     // sort by relative path so that parents are created before children
-    std::sort(newAlbums.begin(), newAlbums.end());
+    qSort(newAlbums);
 
     // create all new albums
     foreach(const AlbumInfo& info, newAlbums)
@@ -1924,7 +1924,7 @@ void AlbumManager::setCurrentAlbums(QList<Album*> albums)
     /**
      * Sort is needed to identify selection correctly, ex AlbumHistory
      */
-    std::sort(albums.begin(), albums.end());
+    qSort(albums.begin(),albums.end());
     d->currentAlbums.clear();
     d->currentAlbums+=albums;
 
diff --git a/core/libs/database/collection/collectionscanner.cpp b/core/libs/database/collection/collectionscanner.cpp
index b3284c8d99..b98d2d799a 100644
--- a/core/libs/database/collection/collectionscanner.cpp
+++ b/core/libs/database/collection/collectionscanner.cpp
@@ -531,7 +531,7 @@ void CollectionScanner::finishCompleteScan(const QStringList& albumPaths)
 
     // remove subalbums from list if parent album is already contained
     QStringList sortedPaths = albumPaths;
-    std::sort(sortedPaths.begin(), sortedPaths.end());
+    qSort(sortedPaths);
     QStringList::iterator it, it2;
 
     for (it = sortedPaths.begin(); it != sortedPaths.end(); )
diff --git a/core/libs/database/imagehistory/imagehistorygraph_boost.h b/core/libs/database/imagehistory/imagehistorygraph_boost.h
index 5c4c49ac5f..affdf48466 100644
--- a/core/libs/database/imagehistory/imagehistorygraph_boost.h
+++ b/core/libs/database/imagehistory/imagehistorygraph_boost.h
@@ -1454,7 +1454,7 @@ protected:
             outEdges = toList<edge_descriptor>(boost::out_edges(u, g));
             // Sort edges. The lessThan we have takes vertices, so we use a lessThan which
             // maps the given edges to their targets, and calls our vertex lessThan.
-            std::sort(outEdges.begin(), outEdges.end(), lessThanMapEdgeToTarget<IncidenceGraph, LessThan>(g, lessThan));
+            qSort(outEdges.begin(), outEdges.end(), lessThanMapEdgeToTarget<IncidenceGraph, LessThan>(g, lessThan));
 
             foreach(const edge_descriptor& e, outEdges)
             {
diff --git a/core/libs/database/imagehistory/imagehistorygraphmodel.cpp b/core/libs/database/imagehistory/imagehistorygraphmodel.cpp
index fbe53b0af9..930bc9eab4 100644
--- a/core/libs/database/imagehistory/imagehistorygraphmodel.cpp
+++ b/core/libs/database/imagehistory/imagehistorygraphmodel.cpp
@@ -521,7 +521,7 @@ void ImageHistoryGraphModel::Private::
 {
     parentItem->addItem(new CategoryItem(title));
 
-    std::sort(vertices.begin(), vertices.end(), sortBy(oldestInfoFirst));
+    qSort(vertices.begin(), vertices.end(), sortBy(oldestInfoFirst));
     bool isFirst     = true;
     VertexItem* item = 0;
 
diff --git a/core/libs/database/models/imagemodel.cpp b/core/libs/database/models/imagemodel.cpp
index cd4dde5520..db30e93a5b 100644
--- a/core/libs/database/models/imagemodel.cpp
+++ b/core/libs/database/models/imagemodel.cpp
@@ -1197,7 +1197,7 @@ QList<QPair<int, int> > ImageModelIncrementalUpdater::toContiguousPairs(const QL
     }
 
     QList<int> indices(unsorted);
-    std::sort(indices.begin(), indices.end());
+    qSort(indices);
 
     QPair<int, int> pair(indices.first(), indices.first());
 
diff --git a/core/libs/database/tags/facetags.cpp b/core/libs/database/tags/facetags.cpp
index dc1f965ce2..cdf08c6613 100644
--- a/core/libs/database/tags/facetags.cpp
+++ b/core/libs/database/tags/facetags.cpp
@@ -398,7 +398,7 @@ int FaceTags::personParentTag()
         QList<int> mosttoplevelTags = tiers.values(tiers.begin().key());
 
         // as a pretty weak criterion, take the largest id which usually corresponds to the latest tag creation.
-        std::sort(mosttoplevelTags.begin(), mosttoplevelTags.end());
+        qSort(mosttoplevelTags);
         return TagsCache::instance()->parentTag(mosttoplevelTags.last());
     }
 
diff --git a/core/libs/dimg/imagehistory/dimagehistory.cpp b/core/libs/dimg/imagehistory/dimagehistory.cpp
index ee24dc206c..2eb2b2ea17 100644
--- a/core/libs/dimg/imagehistory/dimagehistory.cpp
+++ b/core/libs/dimg/imagehistory/dimagehistory.cpp
@@ -534,7 +534,7 @@ QString DImageHistory::toXml() const
             if (!params.isEmpty())
             {
                 QList<QString> keys = params.keys();
-                std::sort(keys.begin(), keys.end());
+                qSort(keys);
 
                 foreach(const QString& key, keys)
                 {
diff --git a/core/libs/dmetadata/dmetadatasettingscontainer.cpp b/core/libs/dmetadata/dmetadatasettingscontainer.cpp
index 32def9519b..4789f7543a 100644
--- a/core/libs/dmetadata/dmetadatasettingscontainer.cpp
+++ b/core/libs/dmetadata/dmetadatasettingscontainer.cpp
@@ -440,7 +440,7 @@ void DMetadataSettingsContainer::readOneGroup(KConfigGroup& group, const QString
         container.append(ns);
     }
 
-    std::sort(container.begin(), container.end(), Digikam::dmcompare);
+    qSort(container.begin(), container.end(), Digikam::dmcompare);
 }
 
 void DMetadataSettingsContainer::writeOneGroup(KConfigGroup& group, const QString& name, QList<NamespaceEntry>& container) const
diff --git a/core/libs/dtrash/dtrashitemmodel.cpp b/core/libs/dtrash/dtrashitemmodel.cpp
index b21ac32446..0abbe7d223 100644
--- a/core/libs/dtrash/dtrashitemmodel.cpp
+++ b/core/libs/dtrash/dtrashitemmodel.cpp
@@ -146,28 +146,28 @@ void DTrashItemModel::sort(int column, Qt::SortOrder order)
         return;
     }
 
-    std::sort(d->data.begin(), d->data.end(),
-                [column, order](const DTrashItemInfo& a, const DTrashItemInfo& b)
+    qSort(d->data.begin(), d->data.end(),
+            [column, order](const DTrashItemInfo& a, const DTrashItemInfo& b)
+            {
+                if (column == 2 && a.deletionTimestamp != b.deletionTimestamp)
                 {
-                    if (column == 2 && a.deletionTimestamp != b.deletionTimestamp)
+                    if (order == Qt::DescendingOrder)
                     {
-                        if (order == Qt::DescendingOrder)
-                        {
-                            return a.deletionTimestamp > b.deletionTimestamp;
-                        }
-                        else
-                        {
-                            return a.deletionTimestamp < b.deletionTimestamp;
-                        }
+                        return a.deletionTimestamp > b.deletionTimestamp;
                     }
-
-                    if (order == Qt::DescendingOrder)
+                    else
                     {
-                        return a.collectionRelativePath > b.collectionRelativePath;
+                        return a.deletionTimestamp < b.deletionTimestamp;
                     }
+                }
+
+                if (order == Qt::DescendingOrder)
+                {
+                    return a.collectionRelativePath > b.collectionRelativePath;
+                }
 
-                    return a.collectionRelativePath < b.collectionRelativePath;
-                });
+                return a.collectionRelativePath < b.collectionRelativePath;
+            });
 
     const QModelIndex topLeft     = index(0, 0, QModelIndex());
     const QModelIndex bottomRight = index(rowCount(QModelIndex())-1,
diff --git a/core/libs/imageproperties/disjointmetadata.cpp b/core/libs/imageproperties/disjointmetadata.cpp
index 3f3cd56bbc..53d5cb2cf0 100644
--- a/core/libs/imageproperties/disjointmetadata.cpp
+++ b/core/libs/imageproperties/disjointmetadata.cpp
@@ -609,7 +609,7 @@ void DisjointMetadata::loadTags( QList<int> &loadedTagIds)
         return;
     }
 
-    std::sort(loadedTagIds.begin(), loadedTagIds.end());
+    qSort(loadedTagIds.begin(),loadedTagIds.end());
     // We search for metadata available tags, and
     // it is not present in current list, set it to
     // disjoint
diff --git a/core/libs/tags/tagfolderview.cpp b/core/libs/tags/tagfolderview.cpp
index d4e1c09dfc..a194af0a5a 100644
--- a/core/libs/tags/tagfolderview.cpp
+++ b/core/libs/tags/tagfolderview.cpp
@@ -136,7 +136,7 @@ void TagFolderView::addCustomContextMenuActions(ContextMenuHelper& cmh, Album* a
     cmh.addSeparator();
     if (d->showDeleteFaceTagsAction)
     {
-        cmh.addActionDeleteFaceTag(tagModificationHelper(), tag);
+        cmh.addActionDeleteFaceTag(tagModificationHelper(),tag);
         cmh.addSeparator();
     }
     else
@@ -146,7 +146,7 @@ void TagFolderView::addCustomContextMenuActions(ContextMenuHelper& cmh, Album* a
         // If the tag is no face tag, add the option to set it as face tag.
         if (!FaceTags::isPerson(tag->id()))
         {
-            cmh.addActionTagToFaceTag(tagModificationHelper(), tag);
+            cmh.addActionTagToFaceTag(tagModificationHelper(),tag);
         }
     }
     cmh.addActionEditTag(tagModificationHelper(), tag);
@@ -199,7 +199,7 @@ void TagFolderView::slotExpandNode()
         {
             expand(child);
             greyNodes.enqueue(child);
-            child = current.child(it++, 0);
+            child = current.child(it++,0);
         }
     }
 }
@@ -234,7 +234,7 @@ void TagFolderView::slotCollapseNode()
         {
             collapse(child);
             greyNodes.enqueue(child);
-            child = current.child(it++, 0);
+            child = current.child(it++,0);
         }
     }
 }
@@ -294,18 +294,18 @@ void TagFolderView::setContexMenuItems(ContextMenuHelper& cmh, QList< TAlbum* >
     cmh.addSeparator();
     if (d->showDeleteFaceTagsAction)
     {
-        cmh.addActionDeleteFaceTags(tagModificationHelper(), albums);
+        cmh.addActionDeleteFaceTags(tagModificationHelper(),albums);
     }
     else
     {
-        cmh.addActionDeleteTags(tagModificationHelper(), albums);
+        cmh.addActionDeleteTags(tagModificationHelper(),albums);
         // If one of the selected tags is no face tag, add the action to mark them as face tags.
         foreach (TAlbum * const tag, albums)
         {
             if (!FaceTags::isPerson(tag->id()))
             {
                 cmh.addSeparator();
-                cmh.addActionTagToFaceTag(tagModificationHelper(), tag);
+                cmh.addActionTagToFaceTag(tagModificationHelper(),tag);
                 break;
             }
         }
@@ -342,7 +342,7 @@ void TagFolderView::contextMenuEvent(QContextMenuEvent* event)
 
     QModelIndexList selectedItems = selectionModel()->selectedIndexes();
 
-    std::sort(selectedItems.begin(), selectedItems.end());
+    qSort(selectedItems.begin(),selectedItems.end());
     QList<TAlbum*> items;
 
     foreach(const QModelIndex& mIndex, selectedItems)
@@ -356,7 +356,7 @@ void TagFolderView::contextMenuEvent(QContextMenuEvent* event)
      */
     if(items.isEmpty())
     {
-        QModelIndex root = this->model()->index(0, 0);
+        QModelIndex root = this->model()->index(0,0);
         items.append(static_cast<TAlbum*>(albumForIndex(root)));
     }
 
diff --git a/core/libs/tags/tagsmanager/tagmngrtreeview.cpp b/core/libs/tags/tagsmanager/tagmngrtreeview.cpp
index 6dec5c6eb7..fb2a6991ba 100644
--- a/core/libs/tags/tagsmanager/tagmngrtreeview.cpp
+++ b/core/libs/tags/tagsmanager/tagmngrtreeview.cpp
@@ -71,7 +71,7 @@ void TagMngrTreeView::contextMenuEvent(QContextMenuEvent* event)
 {
     QModelIndexList selectedItems = selectionModel()->selectedIndexes();
 
-    std::sort(selectedItems.begin(), selectedItems.end());
+    qSort(selectedItems.begin(),selectedItems.end());
     QList<TAlbum*> items;
 
     foreach(const QModelIndex& mIndex, selectedItems)
@@ -85,7 +85,7 @@ void TagMngrTreeView::contextMenuEvent(QContextMenuEvent* event)
      */
     if(items.isEmpty())
     {
-        QModelIndex root = this->model()->index(0, 0);
+        QModelIndex root = this->model()->index(0,0);
         items.append(static_cast<TAlbum*>(albumForIndex(root)));
     }
 
@@ -130,7 +130,7 @@ void TagMngrTreeView::setContexMenuItems(ContextMenuHelper& cmh, QList<TAlbum*>
 
     if (!isRoot)
     {
-        cmh.addActionDeleteTags(tagModificationHelper(), albums);
+        cmh.addActionDeleteTags(tagModificationHelper(),albums);
     }
     else
     {
@@ -194,7 +194,7 @@ void TagMngrTreeView::slotExpandSelected()
 
 void TagMngrTreeView::slotExpandTree()
 {
-    QModelIndex root                 = this->model()->index(0, 0);
+    QModelIndex root                 = this->model()->index(0,0);
     QItemSelectionModel* const model = this->selectionModel();
     QModelIndexList selected         = model->selectedIndexes();
 
@@ -227,7 +227,7 @@ void TagMngrTreeView::slotExpandTree()
                     expand(child);
                 }
 
-                child = current.child(it++, 0);
+                child = current.child(it++,0);
             }
         }
         else
diff --git a/core/libs/widgets/fonts/dfontproperties.cpp b/core/libs/widgets/fonts/dfontproperties.cpp
index c78f8e5cb2..7466b62477 100644
--- a/core/libs/widgets/fonts/dfontproperties.cpp
+++ b/core/libs/widgets/fonts/dfontproperties.cpp
@@ -1037,7 +1037,7 @@ qreal DFontProperties::Private::fillSizeList(const QList<qreal>& sizes_)
 
     // Insert sizes into the listbox.
     sizeListBox->clear();
-    std::sort(sizes.begin(), sizes.end());
+    qSort(sizes);
 
     Q_FOREACH (qreal size, sizes)
     {
@@ -1400,7 +1400,7 @@ QStringList DFontProperties::Private::translateFontNameList(const QStringList& n
 
     // Sort real fonts alphabetically.
 
-    std::sort(trNames.begin(), trNames.end(), localeLessThan);
+    qSort(trNames.begin(), trNames.end(), localeLessThan);
 
     // Prepend generic fonts, in the predefined order.
 
diff --git a/core/libs/widgets/iccprofiles/iccprofilescombobox.cpp b/core/libs/widgets/iccprofiles/iccprofilescombobox.cpp
index 779be49aec..3be93a04a8 100644
--- a/core/libs/widgets/iccprofiles/iccprofilescombobox.cpp
+++ b/core/libs/widgets/iccprofiles/iccprofilescombobox.cpp
@@ -97,7 +97,7 @@ static void formatProfiles(const QList<IccProfile>& givenProfiles, QList<IccProf
         }
     }
 
-    std::sort(profiles.begin(), profiles.end(), iccProfileLessThan);
+    qSort(profiles.begin(), profiles.end(), iccProfileLessThan);
 
     foreach(IccProfile profile, profiles) // krazy:exclude=foreach
     {
diff --git a/core/showfoto/thumbbar/showfotoimagemodel.cpp b/core/showfoto/thumbbar/showfotoimagemodel.cpp
index 500c0ce6e5..08bc5175b3 100644
--- a/core/showfoto/thumbbar/showfotoimagemodel.cpp
+++ b/core/showfoto/thumbbar/showfotoimagemodel.cpp
@@ -542,7 +542,7 @@ QList<QPair<int, int> > ShowfotoImageModel::toContiguousPairs(const QList<int>&
     }
 
     QList<int> indices(unsorted);
-    std::sort(indices.begin(), indices.end());
+    qSort(indices);
 
     QPair<int, int> pair(indices.first(), indices.first());
 
diff --git a/core/tests/dimg/dimghistorygraphtest.cpp b/core/tests/dimg/dimghistorygraphtest.cpp
index e9204954cd..335d8192a5 100644
--- a/core/tests/dimg/dimghistorygraphtest.cpp
+++ b/core/tests/dimg/dimghistorygraphtest.cpp
@@ -183,7 +183,7 @@ void DImgHistoryGraphTest::testEditing()
     controlCloud << IdPair(two.id(), orig.id());
     controlCloud << IdPair(three.id(), orig.id());
     controlCloud << IdPair(four.id(), orig.id());
-    std::sort(controlCloud.begin(), controlCloud.end());
+    qSort(controlCloud);
 
     ImageHistoryGraph graph1 = ImageHistoryGraph::fromInfo(three);
     qDebug() << graph1;
@@ -198,7 +198,7 @@ void DImgHistoryGraphTest::testEditing()
     QVERIFY(graph3.data().vertexCount() == 5);
 
     QList<IdPair> cloud = graph3.relationCloud();
-    std::sort(cloud.begin(), cloud.end());
+    qSort(cloud);
     QVERIFY(cloud == controlCloud);
 
     int needResolvingTag = TagsCache::instance()->getOrCreateInternalTag(InternalTagName::needResolvingHistory());
@@ -301,7 +301,7 @@ void DImgHistoryGraphTest::testGraph()
 
     QList<qlonglong> controlLeaves;
     controlLeaves << 8 << 19 << 20 << 21 << 10 << 3 << 11 << 22 << 24 << 14 << 15 << 16 << 17 << 18;
-    std::sort(controlLeaves.begin(), controlLeaves.end());
+    qSort(controlLeaves);
 
     QList<qlonglong> controlRoots;
     controlRoots << 1;
@@ -429,11 +429,11 @@ void DImgHistoryGraphTest::testGraph()
     }
 
     QList<qlonglong> leaves = mapList(graph.data().leaves(), vertexToId);
-    std::sort(leaves.begin(), leaves.end());
+    qSort(leaves);
     QVERIFY(leaves == controlLeaves);
 
     QList<qlonglong> roots = mapList(graph.data().roots(), vertexToId);
-    std::sort(roots.begin(), roots.end());
+    qSort(roots);
     QVERIFY(roots == controlRoots);
 
     QList<qlonglong> longestPath1 = mapList(graph.data().longestPathTouching(idToVertex.value(18)), vertexToId);
@@ -444,13 +444,13 @@ void DImgHistoryGraphTest::testGraph()
     // depth-first
     QList<qlonglong> subgraphTwo = mapList(graph.data().verticesDominatedBy(idToVertex.value(2), idToVertex.value(1),
                                            HistoryGraph::DepthFirstOrder), vertexToId);
-    std::sort(subgraphTwo.begin(), subgraphTwo.end());
+    qSort(subgraphTwo);
     QVERIFY(subgraphTwo == controlSubgraphTwo);
 
     // breadth-first
     QList<qlonglong> subgraphFour = mapList(graph.data().verticesDominatedBy(idToVertex.value(4), idToVertex.value(1)), vertexToId);
     QVERIFY(subgraphFour.indexOf(22) > subgraphFour.indexOf(13));
-    std::sort(subgraphFour.begin(), subgraphFour.end());
+    qSort(subgraphFour);
     QVERIFY(subgraphFour == controlSubgraphFour);
 
     // depth-first
@@ -461,10 +461,10 @@ void DImgHistoryGraphTest::testGraph()
     QVERIFY(subgraphTwoSorted == controlSubgraphTwoSorted);
 
     QList<qlonglong> rootsOfEighteen = mapList(graph.data().rootsOf(idToVertex.value(18)), vertexToId);
-    std::sort(rootsOfEighteen.begin(), rootsOfEighteen.end());
+    qSort(rootsOfEighteen);
     QVERIFY(rootsOfEighteen == controlRootsOfEighteen);
     QList<qlonglong> leavesFromTwo   = mapList(graph.data().leavesFrom(idToVertex.value(2)), vertexToId);
-    std::sort(leavesFromTwo.begin(), leavesFromTwo.end());
+    qSort(leavesFromTwo);
     QVERIFY(leavesFromTwo == controlLeavesFromTwo);
 }
 
diff --git a/core/utilities/advancedrename/advancedrenamemanager.cpp b/core/utilities/advancedrename/advancedrenamemanager.cpp
index 1c0c207af7..9f83887f80 100644
--- a/core/utilities/advancedrename/advancedrenamemanager.cpp
+++ b/core/utilities/advancedrename/advancedrenamemanager.cpp
@@ -331,19 +331,19 @@ void AdvancedRenameManager::initializeFileList()
     {
         case SortName:
         {
-            std::sort(tmpFiles.begin(), tmpFiles.end(), SortByNameCaseInsensitive());
+            qSort(tmpFiles.begin(), tmpFiles.end(), SortByNameCaseInsensitive());
             break;
         }
 
         case SortDate:
         {
-            std::sort(tmpFiles.begin(), tmpFiles.end(), SortByDate());
+            qSort(tmpFiles.begin(), tmpFiles.end(), SortByDate());
             break;
         }
 
         case SortSize:
         {
-            std::sort(tmpFiles.begin(), tmpFiles.end(), SortBySize());
+            qSort(tmpFiles.begin(), tmpFiles.end(), SortBySize());
             break;
         }
 
diff --git a/core/utilities/geolocation/editor/correlator/track_correlator_thread.cpp b/core/utilities/geolocation/editor/correlator/track_correlator_thread.cpp
index 8dc7b7df66..a5b818b6ea 100644
--- a/core/utilities/geolocation/editor/correlator/track_correlator_thread.cpp
+++ b/core/utilities/geolocation/editor/correlator/track_correlator_thread.cpp
@@ -50,7 +50,7 @@ TrackCorrelatorThread::~TrackCorrelatorThread()
 void TrackCorrelatorThread::run()
 {
     // sort the items to correlate by time:
-    std::sort(itemsToCorrelate.begin(), itemsToCorrelate.end(), TrackCorrelationLessThan);
+    qSort(itemsToCorrelate.begin(), itemsToCorrelate.end(), TrackCorrelationLessThan);
 
     // now perform the correlation
     // we search all loaded gpx data files in parallel for the points with the best match
diff --git a/core/utilities/geolocation/editor/searches/searchresultmodel.cpp b/core/utilities/geolocation/editor/searches/searchresultmodel.cpp
index aea4dc0346..412488ea38 100644
--- a/core/utilities/geolocation/editor/searches/searchresultmodel.cpp
+++ b/core/utilities/geolocation/editor/searches/searchresultmodel.cpp
@@ -315,7 +315,7 @@ void SearchResultModel::removeRowsByIndexes(const QModelIndexList& rowsList)
         return;
     }
 
-    std::sort(rowNumbers.begin(), rowNumbers.end());
+    qSort(rowNumbers.begin(), rowNumbers.end());
 
     // now delete the rows, starting with the last row:
     for (int i = rowNumbers.count()-1; i >= 0; i--)
@@ -340,7 +340,7 @@ void SearchResultModel::removeRowsBySelection(const QItemSelection& selectionLis
     }
 
     // we expect the ranges to be sorted here
-    std::sort(rowRanges.begin(), rowRanges.end(), RowRangeLessThan);
+    qSort(rowRanges.begin(), rowRanges.end(), RowRangeLessThan);
 
     // now delete the rows, starting with the last row:
     for (int i = rowRanges.count()-1; i >= 0; i--)
diff --git a/core/utilities/geolocation/geoiface/tracks/trackreader.cpp b/core/utilities/geolocation/geoiface/tracks/trackreader.cpp
index 71fef9804e..cb58917c08 100644
--- a/core/utilities/geolocation/geoiface/tracks/trackreader.cpp
+++ b/core/utilities/geolocation/geoiface/tracks/trackreader.cpp
@@ -330,7 +330,7 @@ TrackReader::TrackReadResult TrackReader::loadTrackFile(const QUrl& url)
     }
 
     // the correlation algorithm relies on sorted data, therefore sort now
-    std::sort(parsedData.track.points.begin(), parsedData.track.points.end(), TrackManager::TrackPoint::EarlierThan);
+    qSort(parsedData.track.points.begin(), parsedData.track.points.end(), TrackManager::TrackPoint::EarlierThan);
 
     return parsedData;
 }
diff --git a/core/utilities/importui/models/importimagemodel.cpp b/core/utilities/importui/models/importimagemodel.cpp
index 644f436a2a..ce351efa10 100644
--- a/core/utilities/importui/models/importimagemodel.cpp
+++ b/core/utilities/importui/models/importimagemodel.cpp
@@ -926,7 +926,7 @@ QList<QPair<int, int> > ImportImageModelIncrementalUpdater::toContiguousPairs(co
     }
 
     QList<int> indices(unsorted);
-    std::sort(indices.begin(), indices.end());
+    qSort(indices);
 
     QPair<int, int> pair(indices.first(), indices.first());
 
diff --git a/core/utilities/maintenance/imageinfojob.cpp b/core/utilities/maintenance/imageinfojob.cpp
index d3915ceebe..8277e14368 100644
--- a/core/utilities/maintenance/imageinfojob.cpp
+++ b/core/utilities/maintenance/imageinfojob.cpp
@@ -175,7 +175,7 @@ void ImageInfoJob::slotData(const QList<ImageListerRecord>& records)
     }
 
     // Sort the itemList based on name
-    std::sort(itemsList.begin(), itemsList.end(), ImageInfoList::namefileLessThan);
+    qSort(itemsList.begin(), itemsList.end(), ImageInfoList::namefileLessThan);
 
     emit signalItemsInfo(itemsList);
 }
diff --git a/core/utilities/searchwindow/searchutilities.cpp b/core/utilities/searchwindow/searchutilities.cpp
index 3a7fe43410..622a0a73ad 100644
--- a/core/utilities/searchwindow/searchutilities.cpp
+++ b/core/utilities/searchwindow/searchutilities.cpp
@@ -296,7 +296,7 @@ void CustomStepsDoubleSpinBox::setSuggestedValues(const QList<double>& values)
             this, SLOT(slotValueChanged(double)));
 
     d->values = values;
-    std::sort(d->values.begin(), d->values.end());
+    qSort(d->values);
 }
 
 void CustomStepsDoubleSpinBox::setSuggestedInitialValue(double initialValue)
@@ -469,7 +469,7 @@ void CustomStepsIntSpinBox::setSuggestedValues(const QList<int>& values)
             this, SLOT(slotValueChanged(int)));
 
     d->values = values;
-    std::sort(d->values.begin(), d->values.end());
+    qSort(d->values);
 }
 
 void CustomStepsIntSpinBox::setSuggestedInitialValue(int initialValue)
@@ -491,7 +491,7 @@ void CustomStepsIntSpinBox::setInvertStepping(bool invert)
 void CustomStepsIntSpinBox::enableFractionMagic(const QString& prefix)
 {
     d->fractionPrefix = prefix;
-    std::sort(d->values.begin(), d->values.end(), qGreater<int>());
+    qSort(d->values.begin(), d->values.end(), qGreater<int>());
 }
 
 void CustomStepsIntSpinBox::reset()
-- 
2.13.6