diff options
author | hjk <qthjk@ovi.com> | 2012-06-26 17:27:20 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-06-27 22:05:15 +0200 |
commit | ec06d3f1af287a18be36b2cc79b63ce9660ad3b7 (patch) | |
tree | 7c5fd2aa788ee78da1495a34f8a1f18835e0269f /src/plugins/debugger/logwindow.cpp | |
parent | f00487650072c6f811b2ef41b552aa81a0df6efa (diff) |
debugger: make shrinking of log buffer faster
Change-Id: I09ff0bf0c5fcc7df5c5dc9a05752754faee9320a
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/debugger/logwindow.cpp')
-rw-r--r-- | src/plugins/debugger/logwindow.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 40ee9bdb79..74dd0d5473 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -156,7 +156,6 @@ public: DebuggerPane(QWidget *parent) : QPlainTextEdit(parent) { - setMaximumBlockCount(100000); setFrameStyle(QFrame::NoFrame); m_clearContentsAction = new QAction(this); m_clearContentsAction->setText(tr("Clear Contents")); @@ -183,6 +182,18 @@ public: delete menu; } + void append(const QString &text) + { + const int N = 100000; + if (blockCount() > N) { + QTextBlock block = document()->findBlock(9 * N / 10); + QTextCursor tc(block); + tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); + tc.removeSelectedText(); + } + appendPlainText(text); + } + private slots: void saveContents(); @@ -434,7 +445,7 @@ void LogWindow::showOutput(int channel, const QString &output) } pos = nnpos + 1; } - m_combinedText->appendPlainText(out); + m_combinedText->append(out); if (atEnd) { cursor.movePosition(QTextCursor::End); @@ -455,8 +466,8 @@ void LogWindow::showInput(int channel, const QString &input) return; } if (debuggerCore()->boolSetting(LogTimeStamps)) - m_inputText->appendPlainText(logTimeStamp()); - m_inputText->appendPlainText(input); + m_inputText->append(logTimeStamp()); + m_inputText->append(input); QTextCursor cursor = m_inputText->textCursor(); cursor.movePosition(QTextCursor::End); m_inputText->setTextCursor(cursor); |