forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -155,6 +155,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
|
|||||||
connect(verticalScrollBar(), &QAbstractSlider::actionTriggered,
|
connect(verticalScrollBar(), &QAbstractSlider::actionTriggered,
|
||||||
this, &OutputWindow::updateAutoScroll);
|
this, &OutputWindow::updateAutoScroll);
|
||||||
|
|
||||||
|
// For when "Find" changes the position; see QTCREATORBUG-26100.
|
||||||
|
connect(this, &QPlainTextEdit::selectionChanged, this, &OutputWindow::updateAutoScroll,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
undoAction->setEnabled(false);
|
undoAction->setEnabled(false);
|
||||||
redoAction->setEnabled(false);
|
redoAction->setEnabled(false);
|
||||||
cutAction->setEnabled(false);
|
cutAction->setEnabled(false);
|
||||||
@@ -252,7 +256,7 @@ void OutputWindow::showEvent(QShowEvent *e)
|
|||||||
{
|
{
|
||||||
QPlainTextEdit::showEvent(e);
|
QPlainTextEdit::showEvent(e);
|
||||||
if (d->scrollToBottom)
|
if (d->scrollToBottom)
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputWindow::wheelEvent(QWheelEvent *e)
|
void OutputWindow::wheelEvent(QWheelEvent *e)
|
||||||
|
Reference in New Issue
Block a user