diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 74dd0d547350e10b22ff14e489c483368b1b2092..4329b507c02965cef5a43966779ac570b4073957 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -394,6 +394,8 @@ LogWindow::LogWindow(QWidget *parent) connect(m_inputText, SIGNAL(executeLineRequested()), SLOT(executeLine())); + connect(&m_outputTimer, SIGNAL(timeout()), SLOT(doOutput())); + setMinimumHeight(60); } @@ -414,9 +416,6 @@ void LogWindow::showOutput(int channel, const QString &output) if (output.isEmpty()) return; - QTextCursor cursor = m_combinedText->textCursor(); - const bool atEnd = cursor.atEnd(); - const QChar cchar = charForChannel(channel); const QChar nchar = QLatin1Char('\n'); @@ -445,7 +444,24 @@ void LogWindow::showOutput(int channel, const QString &output) } pos = nnpos + 1; } - m_combinedText->append(out); + if (!out.endsWith(nchar)) + out.append(nchar); + + m_queuedOutput.append(out); + m_outputTimer.setSingleShot(true); + m_outputTimer.start(80); +} + +void LogWindow::doOutput() +{ + if (m_queuedOutput.isEmpty()) + return; + + QTextCursor cursor = m_combinedText->textCursor(); + const bool atEnd = cursor.atEnd(); + + m_combinedText->append(m_queuedOutput); + m_queuedOutput.clear(); if (atEnd) { cursor.movePosition(QTextCursor::End); diff --git a/src/plugins/debugger/logwindow.h b/src/plugins/debugger/logwindow.h index a71db75e5e242b3ac0b639ed9121e903e00f4050..7f63a42b0e1e64220491ee631cafae94434b55d5 100644 --- a/src/plugins/debugger/logwindow.h +++ b/src/plugins/debugger/logwindow.h @@ -36,6 +36,7 @@ #include "debuggerconstants.h" #include <QWidget> +#include <QTimer> QT_BEGIN_NAMESPACE class QCursor; @@ -74,6 +75,7 @@ public slots: void executeLine(); void showOutput(int channel, const QString &output); void showInput(int channel, const QString &input); + void doOutput(); signals: void showPage(); @@ -82,12 +84,13 @@ signals: private: DebuggerPane *m_combinedText; // combined input/output DebuggerPane *m_inputText; // scriptable input alone + QTimer m_outputTimer; + QString m_queuedOutput; QLineEdit *m_commandEdit; QLabel *m_commandLabel; bool m_ignoreNextInputEcho; }; - } // namespace Internal } // namespace Debugger