forked from qt-creator/qt-creator
Output panes: Fix auto-scrolling issue
The idea is that the user turns auto-scrolling off by manually moving the scrollbar up and turns it back on again by moving it all the way down. However, at least on my machine I am no longer able to do the latter -- the scrollbar position is always at least one below the maximum. I don't know when, why or how that changed, nor do I know whether it's about Qt, the window system or something else. Either way, we have to account for it. Change-Id: I83aab758d72735d4db45d228eca8bbc7a8eebd93 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -155,6 +155,8 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
|
||||
|
||||
connect(verticalScrollBar(), &QAbstractSlider::sliderMoved,
|
||||
this, &OutputWindow::updateAutoScroll);
|
||||
connect(verticalScrollBar(), &QAbstractSlider::sliderReleased,
|
||||
this, &OutputWindow::updateAutoScroll);
|
||||
|
||||
undoAction->setEnabled(false);
|
||||
redoAction->setEnabled(false);
|
||||
@@ -449,7 +451,7 @@ void OutputWindow::handleOutputChunk(const QString &output, OutputFormat format)
|
||||
|
||||
void OutputWindow::updateAutoScroll()
|
||||
{
|
||||
d->scrollToBottom = isScrollbarAtBottom();
|
||||
d->scrollToBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum() - 1;
|
||||
}
|
||||
|
||||
void OutputWindow::setMaxCharCount(int count)
|
||||
@@ -473,11 +475,6 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
||||
d->queueTimer.start();
|
||||
}
|
||||
|
||||
bool OutputWindow::isScrollbarAtBottom() const
|
||||
{
|
||||
return verticalScrollBar()->value() == verticalScrollBar()->maximum();
|
||||
}
|
||||
|
||||
QMimeData *OutputWindow::createMimeDataFromSelection() const
|
||||
{
|
||||
const auto mimeData = new QMimeData;
|
||||
|
||||
@@ -91,7 +91,6 @@ public slots:
|
||||
void setWordWrapEnabled(bool wrap);
|
||||
|
||||
protected:
|
||||
bool isScrollbarAtBottom() const;
|
||||
virtual void handleLink(const QPoint &pos);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user