diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2021-08-09 10:55:39 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2021-08-13 12:22:19 +0000 |
commit | c69ef181abe5b4c59ccd2d7fd38dfaf1f1368358 (patch) | |
tree | e0732c8207037c2ed2f5025241fd9a0e843e9a1d | |
parent | b8b6af0dbb6c077daf2ef4f26f773e2af58846f3 (diff) |
OutputWindow: Update auto-scroll flag when "Find" changes position
In this case, the text edit's scroll bar does not emit a signal, nor is
scrollContentsBy() called (Qt bug?).
Therefore, we now check the scroll bar position also on a selection
change.
Note that this will still misbehave for the edge case where you search
for something, then scroll back to the bottom, then search for the same
string again and find the same result, because in that case the selection
does not change. We live with that.
Fixes: QTCREATORBUG-26100
Change-Id: Ib5555d9119117dd95c68175c4094bb0fd904f6e5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
-rw-r--r-- | src/plugins/coreplugin/outputwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index e04c3cd71d..138001c104 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -155,6 +155,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget connect(verticalScrollBar(), &QAbstractSlider::actionTriggered, this, &OutputWindow::updateAutoScroll); + // For when "Find" changes the position; see QTCREATORBUG-26100. + connect(this, &QPlainTextEdit::selectionChanged, this, &OutputWindow::updateAutoScroll, + Qt::QueuedConnection); + undoAction->setEnabled(false); redoAction->setEnabled(false); cutAction->setEnabled(false); @@ -252,7 +256,7 @@ void OutputWindow::showEvent(QShowEvent *e) { QPlainTextEdit::showEvent(e); if (d->scrollToBottom) - verticalScrollBar()->setValue(verticalScrollBar()->maximum()); + scrollToBottom(); } void OutputWindow::wheelEvent(QWheelEvent *e) |