diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-11 08:34:37 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-11 08:34:37 (GMT) |
commit | 789c045bfd25eb7921030c4d109e3a2ef27a12a9 (patch) | |
tree | b9201a5e73d4e663e1670875eca219ff8e7bf681 /src/gui/widgets/qplaintextedit.cpp | |
parent | 771e18e96d86f09bb047e5cf45cc33568e259a5d (diff) | |
parent | b7f84c44ae723a77ed34246949e49438491f54e9 (diff) | |
download | Qt-789c045bfd25eb7921030c4d109e3a2ef27a12a9.zip Qt-789c045bfd25eb7921030c4d109e3a2ef27a12a9.tar.gz Qt-789c045bfd25eb7921030c4d109e3a2ef27a12a9.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'src/gui/widgets/qplaintextedit.cpp')
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 14efd23..f317742 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -560,7 +560,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { if (!currentBlock.isValid()) return QRectF(); Q_ASSERT(currentBlock.blockNumber() == currentBlockNumber); - QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout()); + QTextDocument *doc = document(); + QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout()); Q_ASSERT(documentLayout); QPointF offset; @@ -571,13 +572,22 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { offset.ry() += r.height(); currentBlock = currentBlock.next(); ++currentBlockNumber; + if (!currentBlock.isVisible()) { + currentBlock = doc->findBlockByLineNumber(currentBlock.firstLineNumber()); + currentBlockNumber = currentBlock.blockNumber(); + } r = documentLayout->blockBoundingRect(currentBlock); } while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) { currentBlock = currentBlock.previous(); + --currentBlockNumber; + while (!currentBlock.isVisible()) { + currentBlock = currentBlock.previous(); + --currentBlockNumber; + } if (!currentBlock.isValid()) break; - --currentBlockNumber; + r = documentLayout->blockBoundingRect(currentBlock); offset.ry() -= r.height(); } |