Remove qUpperBound usages from qtbase
Replace them with std::upper_bound; this allows for deprecation of qUpperBound. Change-Id: Idef01d2228b9a70eee3d52931d7aedb5bb6ba902 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
1e37d854f7
commit
8e3e34defd
@ -63,6 +63,8 @@
|
||||
#include "QtCore/qcoreapplication.h"
|
||||
#include "private/qobject_p.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -124,7 +126,7 @@ public:
|
||||
// insert event in descending priority order, using upper
|
||||
// bound for a given priority (to ensure proper ordering
|
||||
// of events with the same priority)
|
||||
QPostEventList::iterator at = qUpperBound(begin() + insertionOffset, end(), priority);
|
||||
QPostEventList::iterator at = std::upper_bound(begin() + insertionOffset, end(), priority);
|
||||
insert(at, ev);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "qthreadpool_p.h"
|
||||
#include "qelapsedtimer.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -214,7 +216,7 @@ void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
|
||||
QList<QPair<QRunnable *, int> >::const_iterator begin = queue.constBegin();
|
||||
QList<QPair<QRunnable *, int> >::const_iterator it = queue.constEnd();
|
||||
if (it != begin && priority < (*(it - 1)).second)
|
||||
it = qUpperBound(begin, --it, priority);
|
||||
it = std::upper_bound(begin, --it, priority);
|
||||
queue.insert(it - begin, qMakePair(runnable, priority));
|
||||
runnableReady.wakeOne();
|
||||
}
|
||||
|
@ -934,7 +934,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
Example:
|
||||
\snippet code/src_corelib_tools_qmap.cpp 17
|
||||
|
||||
\sa qUpperBound(), lowerBound(), find()
|
||||
\sa lowerBound(), find()
|
||||
*/
|
||||
|
||||
/*! \fn QMap::const_iterator QMap::upperBound(const Key &key) const
|
||||
|
@ -162,7 +162,7 @@ int QShortcutMap::addShortcut(QObject *owner, const QKeySequence &key, Qt::Short
|
||||
Q_D(QShortcutMap);
|
||||
|
||||
QShortcutEntry newEntry(owner, key, context, --(d->currentId), true, matcher);
|
||||
QList<QShortcutEntry>::iterator it = qUpperBound(d->sequences.begin(), d->sequences.end(), newEntry);
|
||||
QList<QShortcutEntry>::iterator it = std::upper_bound(d->sequences.begin(), d->sequences.end(), newEntry);
|
||||
d->sequences.insert(it, newEntry); // Insert sorted
|
||||
#if defined(DEBUG_QSHORTCUTMAP)
|
||||
qDebug().nospace()
|
||||
|
@ -1022,7 +1022,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
|
||||
firstRow = rowIt - td->rowPositions.constBegin();
|
||||
}
|
||||
|
||||
rowIt = qUpperBound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.bottom() - off.y()));
|
||||
rowIt = std::upper_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.bottom() - off.y()));
|
||||
if (rowIt != td->rowPositions.constEnd()) {
|
||||
++rowIt;
|
||||
lastRow = rowIt - td->rowPositions.constBegin();
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "qrawfont_p.h"
|
||||
#include <qguiapplication.h>
|
||||
#include <qinputmethod.h>
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "qfontengine_qpa_p.h"
|
||||
@ -2552,8 +2553,8 @@ void QTextEngine::setBoundary(int strPos) const
|
||||
if (strPos <= 0 || strPos >= layoutData->string.length())
|
||||
return;
|
||||
|
||||
const QScriptItem* it = qUpperBound(layoutData->items.constBegin(), layoutData->items.constEnd(),
|
||||
strPos, QScriptItemComparator());
|
||||
const QScriptItem* it = std::upper_bound(layoutData->items.constBegin(), layoutData->items.constEnd(),
|
||||
strPos, QScriptItemComparator());
|
||||
Q_ASSERT(it > layoutData->items.constBegin());
|
||||
--it;
|
||||
if (it->position == strPos) {
|
||||
@ -2743,7 +2744,7 @@ void QTextEngine::resolveAdditionalFormats() const
|
||||
|
||||
while (startIt != addFormatSortedByStart.end() &&
|
||||
specialData->addFormats.at(*startIt).start <= si->position) {
|
||||
currentFormats.insert(qUpperBound(currentFormats.begin(), currentFormats.end(), *startIt),
|
||||
currentFormats.insert(std::upper_bound(currentFormats.begin(), currentFormats.end(), *startIt),
|
||||
*startIt);
|
||||
++startIt;
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ void QTextTable::splitCell(int row, int column, int numRows, int numCols)
|
||||
for (int r = row + 1; r < row + rowSpan; ++r) {
|
||||
// find the cell before which to insert the new cell markers
|
||||
int gridIndex = r * d->nCols + column;
|
||||
QVector<int>::iterator it = qUpperBound(d->cellIndices.begin(), d->cellIndices.end(), gridIndex);
|
||||
QVector<int>::iterator it = std::upper_bound(d->cellIndices.begin(), d->cellIndices.end(), gridIndex);
|
||||
int cellIndex = it - d->cellIndices.begin();
|
||||
int fragment = d->cells.value(cellIndex, d->fragment_end);
|
||||
rowPositions[r - row] = p->fragmentMap().position(fragment);
|
||||
|
@ -1426,8 +1426,8 @@ static QRectF boundingRectOfFloatsInSelection(const QTextCursor &cursor)
|
||||
|
||||
const QList<QTextFrame *>::ConstIterator firstFrame = std::lower_bound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionStart(), firstFramePosLessThanCursorPos);
|
||||
const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionEnd(), cursorPosLessThanLastFramePos);
|
||||
const QList<QTextFrame *>::ConstIterator lastFrame = std::upper_bound(children.constBegin(), children.constEnd(),
|
||||
cursor.selectionEnd(), cursorPosLessThanLastFramePos);
|
||||
for (QList<QTextFrame *>::ConstIterator it = firstFrame; it != lastFrame; ++it) {
|
||||
if ((*it)->frameFormat().position() != QTextFrameFormat::InFlow)
|
||||
r |= frame->document()->documentLayout()->frameBoundingRect(*it);
|
||||
|
Loading…
x
Reference in New Issue
Block a user