diff options
author | mae <qt-info@nokia.com> | 2011-04-26 13:41:21 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2011-04-26 13:41:21 (GMT) |
commit | 5d144faf3c524ab557b88f69c4b755e20237e846 (patch) | |
tree | 0b5ba98a9601db36c5f3513bc33ea5f4c30db016 /src/gui/widgets | |
parent | cc3bcc003048760a501debe49b6fcebffaac3cef (diff) | |
download | Qt-5d144faf3c524ab557b88f69c4b755e20237e846.zip Qt-5d144faf3c524ab557b88f69c4b755e20237e846.tar.gz Qt-5d144faf3c524ab557b88f69c4b755e20237e846.tar.bz2 |
Fix insert and scroll to bottom case
When using QtextCursor::insert() with a large text followed by setting
the vertical scrollbar to its maximum value (scroll to bottom),
QPlainTextEdit would not behave properly if a document size
change was triggered by the insertion due to line wrapping.
This was visible in Qt Creator.
Auto test included.
Reviewed-by: con
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 7435691..e7761a1 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -648,6 +648,11 @@ void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx) } control->topBlock = blockNumber; topLine = lineNumber; + + bool vbarSignalsBlocked = vbar->blockSignals(true); + vbar->setValue(block.firstLineNumber() + lineNumber); + vbar->blockSignals(vbarSignalsBlocked); + if (dx || dy) viewport->scroll(q->isRightToLeft() ? -dx : dx, dy); else |