texteditor: use an enum instead of QString as color ids

Change-Id: I658412c18d5ccfe978ec444451c6417ffb18d71c
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
hjk
2012-04-26 14:17:42 +02:00
committed by hjk
parent a872c91c64
commit d006ca80a6
29 changed files with 381 additions and 275 deletions

View File

@@ -110,26 +110,17 @@ void PlainTextEditorWidget::setFontSettings(const FontSettings &fs)
Highlighter *highlighter =
static_cast<Highlighter *>(baseTextDocument()->syntaxHighlighter());
highlighter->configureFormat(Highlighter::VisualWhitespace, fs.toTextCharFormat(
QLatin1String(Constants::C_VISUAL_WHITESPACE)));
highlighter->configureFormat(Highlighter::Keyword, fs.toTextCharFormat(
QLatin1String(Constants::C_KEYWORD)));
highlighter->configureFormat(Highlighter::DataType, fs.toTextCharFormat(
QLatin1String(Constants::C_TYPE)));
highlighter->configureFormat(Highlighter::Comment, fs.toTextCharFormat(
QLatin1String(Constants::C_COMMENT)));
highlighter->configureFormat(Highlighter::VisualWhitespace, fs.toTextCharFormat(C_VISUAL_WHITESPACE));
highlighter->configureFormat(Highlighter::Keyword, fs.toTextCharFormat(C_KEYWORD));
highlighter->configureFormat(Highlighter::DataType, fs.toTextCharFormat(C_TYPE));
highlighter->configureFormat(Highlighter::Comment, fs.toTextCharFormat(C_COMMENT));
// Using C_NUMBER for all kinds of numbers.
highlighter->configureFormat(Highlighter::Decimal, fs.toTextCharFormat(
QLatin1String(Constants::C_NUMBER)));
highlighter->configureFormat(Highlighter::BaseN, fs.toTextCharFormat(
QLatin1String(Constants::C_NUMBER)));
highlighter->configureFormat(Highlighter::Float, fs.toTextCharFormat(
QLatin1String(Constants::C_NUMBER)));
highlighter->configureFormat(Highlighter::Decimal, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::BaseN, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::Float, fs.toTextCharFormat(C_NUMBER));
// Using C_STRING for strings and chars.
highlighter->configureFormat(Highlighter::Char, fs.toTextCharFormat(
QLatin1String(Constants::C_STRING)));
highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(
QLatin1String(Constants::C_STRING)));
highlighter->configureFormat(Highlighter::Char, fs.toTextCharFormat(C_STRING));
highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(C_STRING));
highlighter->rehighlight();
}