OutputFormatter: Remove unused font objects

They're both default-initialized.

Amends 8dfa9a5dab.

Change-Id: Ic990bad2a55a18a205d1cd1f696b7c16cf07377e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2018-11-16 08:52:10 +02:00
committed by Orgad Shaneh
parent bcf879200e
commit f807bbf4c5

View File

@@ -39,7 +39,6 @@ class OutputFormatterPrivate
public: public:
QPlainTextEdit *plainTextEdit = nullptr; QPlainTextEdit *plainTextEdit = nullptr;
QTextCharFormat formats[NumberOfFormats]; QTextCharFormat formats[NumberOfFormats];
QFont font;
QTextCursor cursor; QTextCursor cursor;
AnsiEscapeCodeHandler escapeCodeHandler; AnsiEscapeCodeHandler escapeCodeHandler;
bool overwriteOutput = false; bool overwriteOutput = false;
@@ -126,34 +125,27 @@ void OutputFormatter::initFormats()
if (!plainTextEdit()) if (!plainTextEdit())
return; return;
QFont boldFont;
boldFont.setBold(true);
Theme *theme = creatorTheme(); Theme *theme = creatorTheme();
// NormalMessageFormat // NormalMessageFormat
d->formats[NormalMessageFormat].setFont(boldFont, QTextCharFormat::FontPropertiesSpecifiedOnly); d->formats[NormalMessageFormat].setFontWeight(QFont::Bold);
d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor)); d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor));
// ErrorMessageFormat // ErrorMessageFormat
d->formats[ErrorMessageFormat].setFont(boldFont, QTextCharFormat::FontPropertiesSpecifiedOnly); d->formats[ErrorMessageFormat].setFontWeight(QFont::Bold);
d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor)); d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
// LogMessageFormat // LogMessageFormat
d->formats[LogMessageFormat].setFont(d->font, QTextCharFormat::FontPropertiesSpecifiedOnly);
d->formats[LogMessageFormat].setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor)); d->formats[LogMessageFormat].setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor));
// StdOutFormat // StdOutFormat
d->formats[StdOutFormat].setFont(d->font, QTextCharFormat::FontPropertiesSpecifiedOnly);
d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor)); d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor));
d->formats[StdOutFormatSameLine] = d->formats[StdOutFormat]; d->formats[StdOutFormatSameLine] = d->formats[StdOutFormat];
// StdErrFormat // StdErrFormat
d->formats[StdErrFormat].setFont(d->font, QTextCharFormat::FontPropertiesSpecifiedOnly);
d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor)); d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor));
d->formats[StdErrFormatSameLine] = d->formats[StdErrFormat]; d->formats[StdErrFormatSameLine] = d->formats[StdErrFormat];
d->formats[DebugFormat].setFont(d->font, QTextCharFormat::FontPropertiesSpecifiedOnly);
d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor));
} }