Remove qLowerBound usages from qtbase

Replace them with std::lower_bound; this allows for deprecation of
qLowerBound.

Change-Id: I536e7338eb85ea6c7c1a5bf23121292767927e0b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
Giuseppe D'Angelo 2012-09-18 22:41:59 +01:00 committed by The Qt Project
parent 21d3445243
commit 1e37d854f7
15 changed files with 67 additions and 40 deletions

View File

@ -46,6 +46,8 @@
#include <QtCore/qline.h> #include <QtCore/qline.h>
#include <QtCore/qmutex.h> #include <QtCore/qmutex.h>
#include <algorithm>
#ifndef QT_NO_ANIMATION #ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -243,7 +245,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
if (force || (currentInterval.start.first > 0 && progress < currentInterval.start.first) if (force || (currentInterval.start.first > 0 && progress < currentInterval.start.first)
|| (currentInterval.end.first < 1 && progress > currentInterval.end.first)) { || (currentInterval.end.first < 1 && progress > currentInterval.end.first)) {
//let's update currentInterval //let's update currentInterval
QVariantAnimation::KeyValues::const_iterator it = qLowerBound(keyValues.constBegin(), QVariantAnimation::KeyValues::const_iterator it = std::lower_bound(keyValues.constBegin(),
keyValues.constEnd(), keyValues.constEnd(),
qMakePair(progress, QVariant()), qMakePair(progress, QVariant()),
animationValueLessThan); animationValueLessThan);
@ -321,7 +323,7 @@ void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value)
QVariantAnimation::KeyValue pair(step, value); QVariantAnimation::KeyValue pair(step, value);
QVariantAnimation::KeyValues::iterator result = qLowerBound(keyValues.begin(), keyValues.end(), pair, animationValueLessThan); QVariantAnimation::KeyValues::iterator result = std::lower_bound(keyValues.begin(), keyValues.end(), pair, animationValueLessThan);
if (result == keyValues.end() || result->first != step) { if (result == keyValues.end() || result->first != step) {
keyValues.insert(result, pair); keyValues.insert(result, pair);
} else { } else {

View File

@ -916,7 +916,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\snippet code/src_corelib_tools_qmap.cpp 16 \snippet code/src_corelib_tools_qmap.cpp 16
\sa qLowerBound(), upperBound(), find() \sa upperBound(), find()
*/ */
/*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const /*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const

View File

@ -53,6 +53,8 @@
#include "qdbusabstractadaptor_p.h" #include "qdbusabstractadaptor_p.h"
#include "qdbusmetatype_p.h" #include "qdbusmetatype_p.h"
#include <algorithm>
#ifndef QT_NO_DBUS #ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -222,7 +224,7 @@ void QDBusAdaptorConnector::addAdaptor(QDBusAbstractAdaptor *adaptor)
if (*mci.value()) { if (*mci.value()) {
// find out if this interface exists first // find out if this interface exists first
const char *interface = mci.value(); const char *interface = mci.value();
AdaptorMap::Iterator it = qLowerBound(adaptors.begin(), adaptors.end(), AdaptorMap::Iterator it = std::lower_bound(adaptors.begin(), adaptors.end(),
QByteArray(interface)); QByteArray(interface));
if (it != adaptors.end() && qstrcmp(interface, it->interface) == 0) { if (it != adaptors.end() && qstrcmp(interface, it->interface) == 0) {
// exists. Replace it (though it's probably the same) // exists. Replace it (though it's probably the same)

View File

@ -56,6 +56,8 @@
#include "qdbusthreaddebug_p.h" #include "qdbusthreaddebug_p.h"
#include <algorithm>
#ifndef QT_NO_DBUS #ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -829,7 +831,7 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
// find the position where we'd insert the node // find the position where we'd insert the node
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i)); std::lower_bound(node->children.begin(), node->children.end(), pathComponents.at(i));
if (it != node->children.end() && it->name == pathComponents.at(i)) { if (it != node->children.end() && it->name == pathComponents.at(i)) {
// match: this node exists // match: this node exists
node = it; node = it;
@ -902,7 +904,7 @@ void QDBusConnection::unregisterObject(const QString &path, UnregisterMode mode)
} }
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i)); std::lower_bound(node->children.begin(), node->children.end(), pathComponents.at(i));
if (it == node->children.end() || it->name != pathComponents.at(i)) if (it == node->children.end() || it->name != pathComponents.at(i))
break; // node not found break; // node not found
@ -938,7 +940,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
return node->obj; return node->obj;
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i)); std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
if (it == node->children.constEnd() || it->name != pathComponents.at(i)) if (it == node->children.constEnd() || it->name != pathComponents.at(i))
break; // node not found break; // node not found

View File

@ -66,6 +66,8 @@
#include "qdbusthreaddebug_p.h" #include "qdbusthreaddebug_p.h"
#include <algorithm>
#ifndef QT_NO_DBUS #ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -459,7 +461,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
QStringRef pathComponent(&fullpath, start, end - start); QStringRef pathComponent(&fullpath, start, end - start);
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponent); std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponent);
if (it != node->children.constEnd() && it->name == pathComponent) if (it != node->children.constEnd() && it->name == pathComponent)
// match // match
node = it; node = it;
@ -1419,7 +1421,7 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
} else { } else {
// check if we have an interface matching the name that was asked: // check if we have an interface matching the name that was asked:
QDBusAdaptorConnector::AdaptorMap::ConstIterator it; QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
msg.interface()); msg.interface());
if (it != connector->adaptors.constEnd() && msg.interface() == QLatin1String(it->interface)) { if (it != connector->adaptors.constEnd() && msg.interface() == QLatin1String(it->interface)) {
if (!activateCall(it->adaptor, newflags, msg)) if (!activateCall(it->adaptor, newflags, msg))

View File

@ -58,6 +58,8 @@
#include "qdbusutil_p.h" #include "qdbusutil_p.h"
#include "qdbusvirtualobject.h" #include "qdbusvirtualobject.h"
#include <algorithm>
#ifndef QT_NO_DBUS #ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -245,7 +247,7 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node
} }
} else { } else {
QDBusAdaptorConnector::AdaptorMap::ConstIterator it; QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name); interface_name);
if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
interfaceFound = true; interfaceFound = true;
@ -398,7 +400,7 @@ QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node
} }
} else { } else {
QDBusAdaptorConnector::AdaptorMap::ConstIterator it; QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name); interface_name);
if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) { if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
return propertyWriteReply(msg, interface_name, property_name, return propertyWriteReply(msg, interface_name, property_name,
@ -496,7 +498,7 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n
} else { } else {
// find the class that implements interface_name // find the class that implements interface_name
QDBusAdaptorConnector::AdaptorMap::ConstIterator it; QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name); interface_name);
if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
interfaceFound = true; interfaceFound = true;

View File

@ -48,6 +48,8 @@
#include "qcoreapplication.h" #include "qcoreapplication.h"
#include <private/qkeymapper_p.h> #include <private/qkeymapper_p.h>
#include <algorithm>
#ifndef QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -419,7 +421,7 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
Q_D(const QShortcutMap); Q_D(const QShortcutMap);
QShortcutEntry entry(seq); // needed for searching QShortcutEntry entry(seq); // needed for searching
QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd(); QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd();
QList<QShortcutEntry>::ConstIterator it = qLowerBound(d->sequences.constBegin(), itEnd, entry); QList<QShortcutEntry>::ConstIterator it = std::lower_bound(d->sequences.constBegin(), itEnd, entry);
for (;it != itEnd; ++it) { for (;it != itEnd; ++it) {
if (matches(entry.keyseq, (*it).keyseq) == QKeySequence::ExactMatch && (*it).correctContext() && (*it).enabled) { if (matches(entry.keyseq, (*it).keyseq) == QKeySequence::ExactMatch && (*it).correctContext() && (*it).enabled) {
@ -467,7 +469,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e)
QShortcutEntry entry(d->newEntries.at(i)); // needed for searching QShortcutEntry entry(d->newEntries.at(i)); // needed for searching
QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd(); QList<QShortcutEntry>::ConstIterator itEnd = d->sequences.constEnd();
QList<QShortcutEntry>::ConstIterator it = QList<QShortcutEntry>::ConstIterator it =
qLowerBound(d->sequences.constBegin(), itEnd, entry); std::lower_bound(d->sequences.constBegin(), itEnd, entry);
int oneKSResult = QKeySequence::NoMatch; int oneKSResult = QKeySequence::NoMatch;
int tempRes = QKeySequence::NoMatch; int tempRes = QKeySequence::NoMatch;

View File

@ -61,6 +61,8 @@
#include <qbasictimer.h> #include <qbasictimer.h>
#include "private/qfunctions_p.h" #include "private/qfunctions_p.h"
#include <algorithm>
// #define LAYOUT_DEBUG // #define LAYOUT_DEBUG
#ifdef LAYOUT_DEBUG #ifdef LAYOUT_DEBUG
@ -534,7 +536,7 @@ QTextFrame::Iterator QTextDocumentLayoutPrivate::frameIteratorForYPosition(QFixe
|| y < 0 || y > data(rootFrame)->size.height) || y < 0 || y > data(rootFrame)->size.height)
return rootFrame->begin(); return rootFrame->begin();
QVector<QCheckPoint>::ConstIterator checkPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), y); QVector<QCheckPoint>::ConstIterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), y);
if (checkPoint == checkPoints.end()) if (checkPoint == checkPoints.end())
return rootFrame->begin(); return rootFrame->begin();
@ -706,14 +708,14 @@ QTextDocumentLayoutPrivate::hitTest(QTextTable *table, const QFixedPoint &point,
{ {
QTextTableData *td = static_cast<QTextTableData *>(data(table)); QTextTableData *td = static_cast<QTextTableData *>(data(table));
QVector<QFixed>::ConstIterator rowIt = qLowerBound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y); QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), point.y);
if (rowIt == td->rowPositions.constEnd()) { if (rowIt == td->rowPositions.constEnd()) {
rowIt = td->rowPositions.constEnd() - 1; rowIt = td->rowPositions.constEnd() - 1;
} else if (rowIt != td->rowPositions.constBegin()) { } else if (rowIt != td->rowPositions.constBegin()) {
--rowIt; --rowIt;
} }
QVector<QFixed>::ConstIterator colIt = qLowerBound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x); QVector<QFixed>::ConstIterator colIt = std::lower_bound(td->columnPositions.constBegin(), td->columnPositions.constEnd(), point.x);
if (colIt == td->columnPositions.constEnd()) { if (colIt == td->columnPositions.constEnd()) {
colIt = td->columnPositions.constEnd() - 1; colIt = td->columnPositions.constEnd() - 1;
} else if (colIt != td->columnPositions.constBegin()) { } else if (colIt != td->columnPositions.constBegin()) {
@ -1014,7 +1016,7 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
int lastRow = rows; int lastRow = rows;
if (context.clip.isValid()) { if (context.clip.isValid()) {
QVector<QFixed>::ConstIterator rowIt = qLowerBound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y())); QVector<QFixed>::ConstIterator rowIt = std::lower_bound(td->rowPositions.constBegin(), td->rowPositions.constEnd(), QFixed::fromReal(context.clip.top() - off.y()));
if (rowIt != td->rowPositions.constEnd() && rowIt != td->rowPositions.constBegin()) { if (rowIt != td->rowPositions.constEnd() && rowIt != td->rowPositions.constBegin()) {
--rowIt; --rowIt;
firstRow = rowIt - td->rowPositions.constBegin(); firstRow = rowIt - td->rowPositions.constBegin();
@ -1177,7 +1179,7 @@ void QTextDocumentLayoutPrivate::drawFlow(const QPointF &offset, QPainter *paint
QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end(); QVector<QCheckPoint>::ConstIterator lastVisibleCheckPoint = checkPoints.end();
if (inRootFrame && context.clip.isValid()) { if (inRootFrame && context.clip.isValid()) {
lastVisibleCheckPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom())); lastVisibleCheckPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), QFixed::fromReal(context.clip.bottom()));
} }
QTextBlock previousBlock; QTextBlock previousBlock;
@ -2190,7 +2192,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
bool redoCheckPoints = layoutStruct->fullLayout || checkPoints.isEmpty(); bool redoCheckPoints = layoutStruct->fullLayout || checkPoints.isEmpty();
if (!redoCheckPoints) { if (!redoCheckPoints) {
QVector<QCheckPoint>::Iterator checkPoint = qLowerBound(checkPoints.begin(), checkPoints.end(), layoutFrom); QVector<QCheckPoint>::Iterator checkPoint = std::lower_bound(checkPoints.begin(), checkPoints.end(), layoutFrom);
if (checkPoint != checkPoints.end()) { if (checkPoint != checkPoints.end()) {
if (checkPoint != checkPoints.begin()) if (checkPoint != checkPoints.begin())
--checkPoint; --checkPoint;

View File

@ -50,6 +50,8 @@
#include "qtextengine_p.h" #include "qtextengine_p.h"
#include "qdebug.h" #include "qdebug.h"
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// ### DOC: We ought to explain the CONCEPT of objectIndexes if // ### DOC: We ought to explain the CONCEPT of objectIndexes if
@ -253,7 +255,7 @@ QTextBlockGroup::~QTextBlockGroup()
void QTextBlockGroup::blockInserted(const QTextBlock &block) void QTextBlockGroup::blockInserted(const QTextBlock &block)
{ {
Q_D(QTextBlockGroup); Q_D(QTextBlockGroup);
QTextBlockGroupPrivate::BlockList::Iterator it = qLowerBound(d->blocks.begin(), d->blocks.end(), block); QTextBlockGroupPrivate::BlockList::Iterator it = std::lower_bound(d->blocks.begin(), d->blocks.end(), block);
d->blocks.insert(it, block); d->blocks.insert(it, block);
d->markBlocksDirty(); d->markBlocksDirty();
} }

View File

@ -47,6 +47,7 @@
#include "qvarlengtharray.h" #include "qvarlengtharray.h"
#include "private/qfunctions_p.h" #include "private/qfunctions_p.h"
#include <algorithm>
#include <stdlib.h> #include <stdlib.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -407,7 +408,7 @@ void QTextTablePrivate::fragmentAdded(QChar type, uint fragment)
Q_ASSERT(cells.indexOf(fragment) == -1); Q_ASSERT(cells.indexOf(fragment) == -1);
const uint pos = pieceTable->fragmentMap().position(fragment); const uint pos = pieceTable->fragmentMap().position(fragment);
QFragmentFindHelper helper(pos, pieceTable->fragmentMap()); QFragmentFindHelper helper(pos, pieceTable->fragmentMap());
QList<int>::Iterator it = qLowerBound(cells.begin(), cells.end(), helper); QList<int>::Iterator it = std::lower_bound(cells.begin(), cells.end(), helper);
cells.insert(it, fragment); cells.insert(it, fragment);
if (!fragment_start || pos < pieceTable->fragmentMap().position(fragment_start)) if (!fragment_start || pos < pieceTable->fragmentMap().position(fragment_start))
fragment_start = fragment; fragment_start = fragment;
@ -617,7 +618,7 @@ QTextTableCell QTextTable::cellAt(int position) const
return QTextTableCell(); return QTextTableCell();
QFragmentFindHelper helper(position, map); QFragmentFindHelper helper(position, map);
QList<int>::ConstIterator it = qLowerBound(d->cells.begin(), d->cells.end(), helper); QList<int>::ConstIterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper);
if (it != d->cells.begin()) if (it != d->cells.begin())
--it; --it;

View File

@ -49,6 +49,8 @@
#include "QtCore/QMutexLocker" #include "QtCore/QMutexLocker"
#include "QtNetwork/qauthenticator.h" #include "QtNetwork/qauthenticator.h"
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -67,7 +69,7 @@ public:
QNetworkAuthenticationCredential *findClosestMatch(const QString &domain) QNetworkAuthenticationCredential *findClosestMatch(const QString &domain)
{ {
iterator it = qLowerBound(begin(), end(), domain); iterator it = std::lower_bound(begin(), end(), domain);
if (it == end() && !isEmpty()) if (it == end() && !isEmpty())
--it; --it;
if (it == end() || !domain.startsWith(it->domain)) if (it == end() || !domain.startsWith(it->domain))

View File

@ -47,6 +47,8 @@
#include <private/qwidgetitemdata_p.h> #include <private/qwidgetitemdata_p.h>
#include <private/qlistwidget_p.h> #include <private/qlistwidget_p.h>
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// workaround for VC++ 6.0 linker bug (?) // workaround for VC++ 6.0 linker bug (?)
@ -401,8 +403,8 @@ QList<QListWidgetItem*>::iterator QListModel::sortedInsertionIterator(
Qt::SortOrder order, QListWidgetItem *item) Qt::SortOrder order, QListWidgetItem *item)
{ {
if (order == Qt::AscendingOrder) if (order == Qt::AscendingOrder)
return qLowerBound(begin, end, item, QListModelLessThan()); return std::lower_bound(begin, end, item, QListModelLessThan());
return qLowerBound(begin, end, item, QListModelGreaterThan()); return std::lower_bound(begin, end, item, QListModelGreaterThan());
} }
void QListModel::itemChanged(QListWidgetItem *item) void QListModel::itemChanged(QListWidgetItem *item)

View File

@ -46,6 +46,8 @@
#include <qpainter.h> #include <qpainter.h>
#include <private/qtablewidget_p.h> #include <private/qtablewidget_p.h>
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QTableModel::QTableModel(int rows, int columns, QTableWidget *parent) QTableModel::QTableModel(int rows, int columns, QTableWidget *parent)
@ -671,8 +673,8 @@ QVector<QTableWidgetItem*>::iterator QTableModel::sortedInsertionIterator(
Qt::SortOrder order, QTableWidgetItem *item) Qt::SortOrder order, QTableWidgetItem *item)
{ {
if (order == Qt::AscendingOrder) if (order == Qt::AscendingOrder)
return qLowerBound(begin, end, item, QTableModelLessThan()); return std::lower_bound(begin, end, item, QTableModelLessThan());
return qLowerBound(begin, end, item, QTableModelGreaterThan()); return std::lower_bound(begin, end, item, QTableModelGreaterThan());
} }
bool QTableModel::itemLessThan(const QPair<QTableWidgetItem*,int> &left, bool QTableModel::itemLessThan(const QPair<QTableWidgetItem*,int> &left,

View File

@ -51,6 +51,8 @@
#include <private/qwidgetitemdata_p.h> #include <private/qwidgetitemdata_p.h>
#include <private/qtreewidgetitemiterator_p.h> #include <private/qtreewidgetitemiterator_p.h>
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// workaround for VC++ 6.0 linker bug (?) // workaround for VC++ 6.0 linker bug (?)
@ -709,8 +711,8 @@ QList<QTreeWidgetItem*>::iterator QTreeModel::sortedInsertionIterator(
Qt::SortOrder order, QTreeWidgetItem *item) Qt::SortOrder order, QTreeWidgetItem *item)
{ {
if (order == Qt::AscendingOrder) if (order == Qt::AscendingOrder)
return qLowerBound(begin, end, item, QTreeModelLessThan()); return std::lower_bound(begin, end, item, QTreeModelLessThan());
return qLowerBound(begin, end, item, QTreeModelGreaterThan()); return std::lower_bound(begin, end, item, QTreeModelGreaterThan());
} }
QStringList QTreeModel::mimeTypes() const QStringList QTreeModel::mimeTypes() const

View File

@ -94,6 +94,8 @@
#define ACCEL_KEY(k) QString() #define ACCEL_KEY(k) QString()
#endif #endif
#include <algorithm>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// could go into QTextCursor... // could go into QTextCursor...
@ -1422,7 +1424,7 @@ static QRectF boundingRectOfFloatsInSelection(const QTextCursor &cursor)
QTextFrame *frame = cursor.currentFrame(); QTextFrame *frame = cursor.currentFrame();
const QList<QTextFrame *> children = frame->childFrames(); const QList<QTextFrame *> children = frame->childFrames();
const QList<QTextFrame *>::ConstIterator firstFrame = qLowerBound(children.constBegin(), children.constEnd(), const QList<QTextFrame *>::ConstIterator firstFrame = std::lower_bound(children.constBegin(), children.constEnd(),
cursor.selectionStart(), firstFramePosLessThanCursorPos); cursor.selectionStart(), firstFramePosLessThanCursorPos);
const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(), const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(),
cursor.selectionEnd(), cursorPosLessThanLastFramePos); cursor.selectionEnd(), cursorPosLessThanLastFramePos);