From 13e7ffd5c22e0a7de16f9b8d5a192edbdcc95c04 Mon Sep 17 00:00:00 2001
From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Date: Thu, 12 Sep 2013 11:06:59 +0200
Subject: [PATCH] Remove qLowerBound usages from declarative

QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I85df32525af0c5706c631555a06b66ef3484d797
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
---
 src/qml/jsruntime/qv4mm.cpp        | 2 +-
 src/quick/items/qquicktextedit.cpp | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 67ae5d6888..2d53fa3fe5 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -582,7 +582,7 @@ void MemoryManager::collectFromStack() const
 
         if (genericPtr < *heapChunkBoundaries || genericPtr > *(heapChunkBoundariesEnd - 1))
             continue;
-        int index = qLowerBound(heapChunkBoundaries, heapChunkBoundariesEnd, genericPtr) - heapChunkBoundaries;
+        int index = std::lower_bound(heapChunkBoundaries, heapChunkBoundariesEnd, genericPtr) - heapChunkBoundaries;
         // An odd index means the pointer is _before_ the end of a heap chunk and therefore valid.
         assert(index >= 0 && index < m_d->heapChunks.count() * 2);
         if (index & 1) {
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 6ee05700ae..d79de5d1b1 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -57,7 +57,6 @@
 #include <QtGui/qtextobject.h>
 #include <QtGui/qtexttable.h>
 #include <QtCore/qmath.h>
-#include <QtCore/qalgorithms.h>
 
 #include <private/qqmlglobal_p.h>
 #include <private/qqmlproperty_p.h>
@@ -66,6 +65,8 @@
 
 #include "qquicktextdocument.h"
 
+#include <algorithm>
+
 QT_BEGIN_NAMESPACE
 
 /*!
@@ -1859,7 +1860,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
                     if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame
                         break;
 
-                    QList<int>::const_iterator lowerBound = qLowerBound(frameBoundaries, block.next().position());
+                    QList<int>::const_iterator lowerBound = std::lower_bound(frameBoundaries.constBegin(), frameBoundaries.constEnd(), block.next().position());
                     if (currentNodeSize > nodeBreakingSize || *lowerBound > nodeStart) {
                         currentNodeSize = 0;
                         d->addCurrentTextNodeToRoot(rootNode, node, nodeIterator, nodeStart);
@@ -2039,13 +2040,13 @@ void QQuickTextEdit::markDirtyNodesForRange(int start, int end, int charDelta)
         return;
 
     TextNode dummyNode(start, 0);
-    TextNodeIterator it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &dummyNode, &comesBefore);
+    TextNodeIterator it = std::lower_bound(d->textNodeMap.begin(), d->textNodeMap.end(), &dummyNode, &comesBefore);
     // qLowerBound gives us the first node past the start of the affected portion, rewind to the first node
     // that starts at the last position before the edit position. (there might be several because of images)
     if (it != d->textNodeMap.begin()) {
         --it;
         TextNode otherDummy((*it)->startPos(), 0);
-        it = qLowerBound(d->textNodeMap.begin(), d->textNodeMap.end(), &otherDummy, &comesBefore);
+        it = std::lower_bound(d->textNodeMap.begin(), d->textNodeMap.end(), &otherDummy, &comesBefore);
     }
 
     // mark the affected nodes as dirty
-- 
GitLab