summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-08-24 10:21:02 (GMT)
committermae <qt-info@nokia.com>2009-08-24 12:53:03 (GMT)
commitc9d2f14b2a814fd29c858d9519e82fc5cbc2afdf (patch)
treefbf7ec0c5cd4204e2f64e24bb838b39fb3c74ec3 /src/gui
parente3078a5db9e092d78813180ce077789551929e4f (diff)
downloadQt-c9d2f14b2a814fd29c858d9519e82fc5cbc2afdf.zip
Qt-c9d2f14b2a814fd29c858d9519e82fc5cbc2afdf.tar.gz
Qt-c9d2f14b2a814fd29c858d9519e82fc5cbc2afdf.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.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 384889d..267de38 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -562,13 +562,14 @@ 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;
r = documentLayout->blockBoundingRect(currentBlock);
}
- while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) {
+ while (currentBlockNumber > blockNumber && offset.y() + maxVerticalOffset >= -textEdit->viewport()->height()) {
currentBlock = currentBlock.previous();
if (!currentBlock.isValid())
break;