From fff7e32877f11a4a6e0f07a8030f3c9d5eac5584 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 17 Feb 2020 14:46:04 +0100 Subject: [PATCH] OutputWindow: Cleanup and modernize Change-Id: Ie78c84e2677cabb144cfc678e5d1007fcae1f33a Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/outputwindow.cpp | 14 +++++++------- src/plugins/coreplugin/outputwindow.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 3c7941ba6fc..149c7189fdb 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -49,7 +49,7 @@ namespace Internal { class OutputWindowPrivate { public: - OutputWindowPrivate(QTextDocument *document) + explicit OutputWindowPrivate(QTextDocument *document) : cursor(document) { } @@ -159,7 +159,7 @@ OutputWindow::~OutputWindow() delete d; } -void OutputWindow::mousePressEvent(QMouseEvent * e) +void OutputWindow::mousePressEvent(QMouseEvent *e) { d->mouseButtonPressed = e->button(); QPlainTextEdit::mousePressEvent(e); @@ -369,11 +369,11 @@ QString OutputWindow::doNewlineEnforcement(const QString &out) d->scrollToBottom = true; QString s = out; if (d->enforceNewline) { - s.prepend(QLatin1Char('\n')); + s.prepend('\n'); d->enforceNewline = false; } - if (s.endsWith(QLatin1Char('\n'))) { + if (s.endsWith('\n')) { d->enforceNewline = true; // make appendOutputInline put in a newline next time s.chop(1); } @@ -445,7 +445,7 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format) if (enforceNewline) { out.prepend('\n'); } else { - const int newline = out.indexOf(QLatin1Char('\n')); + const int newline = out.indexOf('\n'); moveCursor(QTextCursor::End); if (newline != -1) { if (d->formatter) @@ -457,7 +457,7 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format) if (out.isEmpty()) { d->enforceNewline = true; } else { - if (out.endsWith(QLatin1Char('\n'))) { + if (out.endsWith('\n')) { d->enforceNewline = true; out.chop(1); } @@ -500,7 +500,7 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form tmp.setFontWeight(QFont::Bold); d->cursor.insertText(doNewlineEnforcement(tr("Additional output omitted. You can increase " "the limit in the \"Build & Run\" settings.") - + QLatin1Char('\n')), tmp); + + '\n'), tmp); } d->cursor.endEditBlock(); diff --git a/src/plugins/coreplugin/outputwindow.h b/src/plugins/coreplugin/outputwindow.h index 8490caa5d49..509ae6dfab0 100644 --- a/src/plugins/coreplugin/outputwindow.h +++ b/src/plugins/coreplugin/outputwindow.h @@ -109,7 +109,7 @@ private: QString doNewlineEnforcement(const QString &out); void filterNewContent(); - Internal::OutputWindowPrivate *d; + Internal::OutputWindowPrivate *d = nullptr; }; } // namespace Core