summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-12-14 16:56:38 (GMT)
committerck <qt-info@nokia.com>2009-12-14 16:56:38 (GMT)
commit767260d1f4d7f667ca788756a98a3ce3497419b9 (patch)
treebd712718d883dec1834cfb8898d82f5f071f3e32
parent91f03a835150984fb4a2accf1246327e3d82e1fe (diff)
parent764c4a456526ea07ce6c264139457f0e62968731 (diff)
downloadQt-767260d1f4d7f667ca788756a98a3ce3497419b9.zip
Qt-767260d1f4d7f667ca788756a98a3ce3497419b9.tar.gz
Qt-767260d1f4d7f667ca788756a98a3ce3497419b9.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt
-rw-r--r--src/gui/widgets/qplaintextedit.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index b637c19..be24012 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -684,8 +684,12 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC
qreal h = center ? line.naturalTextRect().center().y() : line.naturalTextRect().bottom();
+ QTextBlock previousVisibleBlock = block;
while (h < height && block.previous().isValid()) {
- block = block.previous();
+ previousVisibleBlock = block;
+ do {
+ block = block.previous();
+ } while (!block.isVisible() && block.previous().isValid());
h += q->blockBoundingRect(block).height();
}
@@ -699,8 +703,8 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC
++l;
}
- if (block.next().isValid() && l >= lineCount) {
- block = block.next();
+ if (l >= lineCount) {
+ block = previousVisibleBlock;
l = 0;
}
setTopBlock(block.blockNumber(), l);