summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-30 02:35:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-30 02:35:46 (GMT)
commit9a23f377b38a2e65da9b67982d7ca770dbcc16b0 (patch)
tree3a9a2eb64855fcab3cdf911a71955bb9282ab62a /src/corelib/tools
parenta716c176c5a89c5dd0e3f0a9b6738d8a217ee6b9 (diff)
parent84413a25bc025f099a075387fb6ab8449d9ef217 (diff)
downloadQt-9a23f377b38a2e65da9b67982d7ca770dbcc16b0.zip
Qt-9a23f377b38a2e65da9b67982d7ca770dbcc16b0.tar.gz
Qt-9a23f377b38a2e65da9b67982d7ca770dbcc16b0.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Return correct boundaries reasons from QTextBoundaryFinder. GridView jumps to beginning of list when resized
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index c2bb094..34bc406 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -457,33 +457,23 @@ QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() cons
return NotAtBoundary;
return StartWord;
}
- if (pos >= length - 1) {
+ if (pos == length) {
if (d->attributes[length-1].whiteSpace)
return NotAtBoundary;
return EndWord;
}
- BoundaryReasons answer;
- const bool nextIsSpace = d->attributes[pos + 1].whiteSpace;
+ const bool nextIsSpace = d->attributes[pos].whiteSpace;
const bool prevIsSpace = d->attributes[pos - 1].whiteSpace;
- if (d->attributes[pos].whiteSpace)
- answer = EndWord;
- else if (!prevIsSpace) {
- answer = StartWord;
- answer |= EndWord;
- }
-
- if (prevIsSpace)
- answer |= StartWord;
- if (nextIsSpace)
- answer |= EndWord;
- if (answer == 0) {
- answer = StartWord;
- answer |= EndWord;
- }
-
- return answer;
+ if (prevIsSpace && !nextIsSpace)
+ return StartWord;
+ else if (!prevIsSpace && nextIsSpace)
+ return EndWord;
+ else if (!prevIsSpace && !nextIsSpace)
+ return BoundaryReasons(StartWord | EndWord);
+ else
+ return NotAtBoundary;
}
QT_END_NAMESPACE