summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/baseeditordocumentprocessor.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@theqtcompany.com>2015-12-09 12:24:53 +0100
committerMarco Bubke <marco.bubke@theqtcompany.com>2015-12-09 11:31:02 +0000
commit6e5f90917f4cbe092816ac82434f827f67082f4d (patch)
treef818911b5f2a90ce67925d4dd95735cae2990a48 /src/plugins/cpptools/baseeditordocumentprocessor.cpp
parent4453ed4fc2ce5a0a662f8b6172562c16a1ca5eed (diff)
downloadqt-creator-6e5f90917f4cbe092816ac82434f827f67082f4d.tar.gz
Use text settings instead of hard coded diagnostic text formats
Change-Id: Id51d03a46b4403d9224508ff3c7647b829ee69cd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/baseeditordocumentprocessor.cpp')
-rw-r--r--src/plugins/cpptools/baseeditordocumentprocessor.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.cpp b/src/plugins/cpptools/baseeditordocumentprocessor.cpp
index 43f5fb9029..33e9887756 100644
--- a/src/plugins/cpptools/baseeditordocumentprocessor.cpp
+++ b/src/plugins/cpptools/baseeditordocumentprocessor.cpp
@@ -34,6 +34,9 @@
#include "cpptoolsreuse.h"
#include "editordocumenthandle.h"
+#include <texteditor/fontsettings.h>
+#include <texteditor/texteditorsettings.h>
+
#include <utils/qtcassert.h>
#include <QTextBlock>
@@ -82,15 +85,10 @@ QList<QTextEdit::ExtraSelection> BaseEditorDocumentProcessor::toTextEditorSelect
const QList<CPlusPlus::Document::DiagnosticMessage> &diagnostics,
QTextDocument *textDocument)
{
- // Format for errors
- QTextCharFormat errorFormat;
- errorFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- errorFormat.setUnderlineColor(Qt::red);
-
- // Format for warnings
- QTextCharFormat warningFormat;
- warningFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- warningFormat.setUnderlineColor(Qt::darkYellow);
+ const TextEditor::FontSettings &fontSettings = TextEditor::TextEditorSettings::instance()->fontSettings();
+
+ QTextCharFormat warningFormat = fontSettings.toTextCharFormat(TextEditor::C_WARNING);
+ QTextCharFormat errorFormat = fontSettings.toTextCharFormat(TextEditor::C_ERROR);
QList<QTextEdit::ExtraSelection> result;
foreach (const CPlusPlus::Document::DiagnosticMessage &m, diagnostics) {