Skip to content
Snippets Groups Projects
Commit ddb424a1 authored by dt's avatar dt
Browse files

Fixes scrolling to the bottom of compile output

Patch mostly by mae.

Task-Nr:  QTCREATORBUG-1405
parent 44bf80a6
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,10 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *) ...@@ -92,6 +92,10 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *)
void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat &textCharFormat) void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat &textCharFormat)
{ {
if (m_textEdit->document()->blockCount() > 10000)
return;
bool shouldScroll = (m_textEdit->verticalScrollBar()->value() ==
m_textEdit->verticalScrollBar()->maximum());
QString textWithNewline = text; QString textWithNewline = text;
if (!textWithNewline.endsWith("\n")) if (!textWithNewline.endsWith("\n"))
textWithNewline.append("\n"); textWithNewline.append("\n");
...@@ -99,7 +103,17 @@ void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat ...@@ -99,7 +103,17 @@ void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat
cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::End);
cursor.beginEditBlock(); cursor.beginEditBlock();
cursor.insertText(textWithNewline, textCharFormat); cursor.insertText(textWithNewline, textCharFormat);
if (m_textEdit->document()->blockCount() > 10000) {
QTextCharFormat tmp;
tmp.setFontWeight(QFont::Bold);
cursor.insertText(tr("Additional output omitted\n"), tmp);
}
cursor.endEditBlock(); cursor.endEditBlock();
if (shouldScroll)
m_textEdit->setTextCursor(cursor);
} }
void CompileOutputWindow::clearContents() void CompileOutputWindow::clearContents()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment