diff options
author | mae <qt-info@nokia.com> | 2009-08-24 10:21:02 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-08-24 12:38:00 (GMT) |
commit | b01118f244ec45685407ebd393b1e44af8360add (patch) | |
tree | 8988f90268898f0ebf90963f86f6c3f2126bde41 /src/gui | |
parent | d4aefc60abf3e014633b9a7544cb4b701864a061 (diff) | |
download | Qt-b01118f244ec45685407ebd393b1e44af8360add.zip Qt-b01118f244ec45685407ebd393b1e44af8360add.tar.gz Qt-b01118f244ec45685407ebd393b1e44af8360add.tar.bz2 |
Fix QPlainTextEdit painting errors
With line wrapping enabled and very large text blocks, painting errors
could occur.
Reviewed-by: hjk
(cherry picked from commit 82dba1d346a6f4a5d2602d930e0aed75c13bcafb)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 20de404..03c36d7 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -573,7 +573,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { if (!block.isValid()) return QRectF(); QRectF r = documentLayout->blockBoundingRect(currentBlock); - while (currentBlockNumber < blockNumber && offset.y() <= 2* textEdit->viewport()->height()) { + int maxVerticalOffset = r.height(); + while (currentBlockNumber < blockNumber && offset.y() - maxVerticalOffset <= 2* textEdit->viewport()->height()) { offset.ry() += r.height(); currentBlock = currentBlock.next(); ++currentBlockNumber; @@ -583,7 +584,7 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { } r = documentLayout->blockBoundingRect(currentBlock); } - while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) { + while (currentBlockNumber > blockNumber && offset.y() + maxVerticalOffset >= -textEdit->viewport()->height()) { currentBlock = currentBlock.previous(); --currentBlockNumber; while (!currentBlock.isVisible()) { |