diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-30 02:35:46 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-30 02:35:46 (GMT) |
commit | 9a23f377b38a2e65da9b67982d7ca770dbcc16b0 (patch) | |
tree | 3a9a2eb64855fcab3cdf911a71955bb9282ab62a /src | |
parent | a716c176c5a89c5dd0e3f0a9b6738d8a217ee6b9 (diff) | |
parent | 84413a25bc025f099a075387fb6ab8449d9ef217 (diff) | |
download | Qt-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')
-rw-r--r-- | src/corelib/tools/qtextboundaryfinder.cpp | 30 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 |
2 files changed, 11 insertions, 21 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 diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 546f75e..b890c4f 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -197,6 +197,7 @@ public: if (q->isComponentComplete()) { clear(); updateGrid(); + setPosition(0); q->refill(); updateCurrent(currentIndex); } @@ -689,7 +690,6 @@ void QDeclarativeGridViewPrivate::updateGrid() q->setContentHeight(endPosition() - startPosition()); else q->setContentWidth(lastPosition() - originPosition()); - setPosition(0); } } |