diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2013-09-20 16:22:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-23 21:20:47 +0200 |
commit | bacbf1fcf35afcece74270fda5521d43b039ee48 (patch) | |
tree | ced3c76a8275c976a54847e9df542077996c68f5 /src/gui/text/qtexttable.cpp | |
parent | cc778e1d2108806ef5d14b87eddd3ce8999c27ee (diff) |
Remove some qBinaryFind usages from QtGui
This is done per the mailing list discussion at
http://www.mail-archive.com/development@qt-project.org/msg01603.html
Change-Id: Iecb921cd778571d24680254566e9aa8fc8d5edff
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/text/qtexttable.cpp')
-rw-r--r-- | src/gui/text/qtexttable.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index a56f8060e0..879c3ddc70 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -393,10 +393,10 @@ int QTextTablePrivate::findCellIndex(int fragment) const { QFragmentFindHelper helper(pieceTable->fragmentMap().position(fragment), pieceTable->fragmentMap()); - QList<int>::ConstIterator it = qBinaryFind(cells.begin(), cells.end(), helper); - if (it == cells.end()) + QList<int>::ConstIterator it = std::lower_bound(cells.constBegin(), cells.constEnd(), helper); + if ((it == cells.constEnd()) || (helper < *it)) return -1; - return it - cells.begin(); + return it - cells.constBegin(); } void QTextTablePrivate::fragmentAdded(QChar type, uint fragment) @@ -1048,8 +1048,9 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols) // find the position at which to insert the contents of the merged cells QFragmentFindHelper helper(origCellPosition, p->fragmentMap()); - QList<int>::Iterator it = qBinaryFind(d->cells.begin(), d->cells.end(), helper); + QList<int>::Iterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper); Q_ASSERT(it != d->cells.end()); + Q_ASSERT(!(helper < *it)); Q_ASSERT(*it == cellFragment); const int insertCellIndex = it - d->cells.begin(); int insertFragment = d->cells.value(insertCellIndex + 1, d->fragment_end); @@ -1080,8 +1081,9 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols) if (firstCellIndex == -1) { QFragmentFindHelper helper(pos, p->fragmentMap()); - QList<int>::Iterator it = qBinaryFind(d->cells.begin(), d->cells.end(), helper); + QList<int>::Iterator it = std::lower_bound(d->cells.begin(), d->cells.end(), helper); Q_ASSERT(it != d->cells.end()); + Q_ASSERT(!(helper < *it)); Q_ASSERT(*it == fragment); firstCellIndex = cellIndex = it - d->cells.begin(); } |