Use text settings instead of hard coded diagnostic text formats

Change-Id: Id51d03a46b4403d9224508ff3c7647b829ee69cd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2015-12-09 12:24:53 +01:00
parent 4453ed4fc2
commit 6e5f90917f
5 changed files with 38 additions and 34 deletions

View File

@@ -66,6 +66,7 @@
#include <texteditor/fontsettings.h>
#include <texteditor/tabsettings.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/syntaxhighlighter.h>
#include <texteditor/refactoroverlay.h>
#include <texteditor/codeassist/genericproposal.h>
@@ -194,12 +195,13 @@ static void appendExtraSelectionsForMessages(
sel.cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d.loc.length);
}
if (d.isWarning())
sel.format.setUnderlineColor(Qt::darkYellow);
else
sel.format.setUnderlineColor(Qt::red);
const auto fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
if (d.isWarning())
sel.format = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
else
sel.format = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
sel.format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
sel.format.setToolTip(d.message);
selections->append(sel);