aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/generichighlighter
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2016-09-23 15:46:41 +0200
committerTim Jenssen <tim.jenssen@qt.io>2016-09-23 14:27:01 +0000
commitd915b22db9a3e66a2faa045251f7df2146dd428e (patch)
tree726fc40b312c0e86c4a6469f064d7e3b9fcac78c /src/plugins/texteditor/generichighlighter
parent669d04a686418541f83a1936d4b278721ec986fe (diff)
improve static initializers
Change-Id: I304fdd6627f01fc216c84930da607127c52409d9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/texteditor/generichighlighter')
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.cpp61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index 1cefcfc2a5..877767f4c4 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -85,37 +85,36 @@ Highlighter::Highlighter(QTextDocument *parent) :
m_dynamicContextsCounter(0),
m_isBroken(false)
{
- static QVector<TextStyle> categories;
- if (categories.isEmpty()) {
- categories << C_TEXT // Normal
- << C_VISUAL_WHITESPACE // VisualWhitespace
- << C_KEYWORD // Keyword
- << C_TYPE // DataType
- << C_COMMENT // Comment
- << C_NUMBER // Decimal
- << C_NUMBER // BaseN
- << C_NUMBER // Float
- << C_STRING // Char
- << C_STRING // SpecialChar
- << C_STRING // String
- << C_WARNING // Alert
- << C_TEXT // Information
- << C_WARNING // Warning
- << C_ERROR // Error
- << C_FUNCTION // Function
- << C_TEXT // RegionMarker
- << C_PREPROCESSOR // BuiltIn
- << C_PRIMITIVE_TYPE // Extension
- << C_OPERATOR // Operator
- << C_LOCAL // Variable
- << C_LABEL // Attribute
- << C_TEXT // Annotation
- << C_COMMENT // CommentVar
- << C_PREPROCESSOR // Import
- << C_TEXT // Others
- << C_LOCAL // Identifier
- << C_DOXYGEN_COMMENT; // Documentation
- }
+ static const QVector<TextStyle> categories({
+ C_TEXT, // Normal
+ C_VISUAL_WHITESPACE, // VisualWhitespace
+ C_KEYWORD, // Keyword
+ C_TYPE, // DataType
+ C_COMMENT, // Comment
+ C_NUMBER, // Decimal
+ C_NUMBER, // BaseN
+ C_NUMBER, // Float
+ C_STRING, // Char
+ C_STRING, // SpecialChar
+ C_STRING, // String
+ C_WARNING, // Alert
+ C_TEXT, // Information
+ C_WARNING, // Warning
+ C_ERROR, // Error
+ C_FUNCTION, // Function
+ C_TEXT, // RegionMarker
+ C_PREPROCESSOR, // BuiltIn
+ C_PRIMITIVE_TYPE, // Extension
+ C_OPERATOR, // Operator
+ C_LOCAL, // Variable
+ C_LABEL, // Attribute
+ C_TEXT, // Annotation
+ C_COMMENT, // CommentVar
+ C_PREPROCESSOR, // Import
+ C_TEXT, // Others
+ C_LOCAL, // Identifier
+ C_DOXYGEN_COMMENT // Documentation
+ });
setTextFormatCategories(categories);
}