diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 1417eb1e3d8..344d117e4fa 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -36,11 +36,13 @@ #include #include +#include #include #include #include #include #include +#include #ifdef WITH_TESTS #include @@ -89,6 +91,8 @@ public: int lastFilteredBlockNumber = -1; QPalette originalPalette; OutputWindow::FilterModeFlags filterMode = OutputWindow::FilterModeFlag::Default; + QTimer scrollTimer; + QElapsedTimer lastMessage; }; } // namespace Internal @@ -161,11 +165,11 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget cutAction->setEnabled(false); copyAction->setEnabled(false); - m_scrollTimer.setInterval(10); - m_scrollTimer.setSingleShot(true); - connect(&m_scrollTimer, &QTimer::timeout, + d->scrollTimer.setInterval(10); + d->scrollTimer.setSingleShot(true); + connect(&d->scrollTimer, &QTimer::timeout, this, &OutputWindow::scrollToBottom); - m_lastMessage.start(); + d->lastMessage.start(); d->originalFontSize = font().pointSizeF(); @@ -426,20 +430,20 @@ void OutputWindow::handleOutputChunk(const QString &output, OutputFormat format) } } - const bool atBottom = isScrollbarAtBottom() || m_scrollTimer.isActive(); + const bool atBottom = isScrollbarAtBottom() || d->scrollTimer.isActive(); d->scrollToBottom = true; d->formatter.appendMessage(out, format); if (atBottom) { - if (m_lastMessage.elapsed() < 5) { - m_scrollTimer.start(); + if (d->lastMessage.elapsed() < 5) { + d->scrollTimer.start(); } else { - m_scrollTimer.stop(); + d->scrollTimer.stop(); scrollToBottom(); } } - m_lastMessage.start(); + d->lastMessage.start(); enableUndoRedo(); } diff --git a/src/plugins/coreplugin/outputwindow.h b/src/plugins/coreplugin/outputwindow.h index d717fbe4f63..91a69d20421 100644 --- a/src/plugins/coreplugin/outputwindow.h +++ b/src/plugins/coreplugin/outputwindow.h @@ -30,9 +30,7 @@ #include -#include #include -#include namespace Utils { class OutputFormatter; @@ -106,8 +104,6 @@ private: void wheelEvent(QWheelEvent *e) override; using QPlainTextEdit::setFont; // call setBaseFont instead, which respects the zoom factor - QTimer m_scrollTimer; - QElapsedTimer m_lastMessage; void enableUndoRedo(); void filterNewContent(); void handleNextOutputChunk(); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 83877266d04..de92f588cb0 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #include #include