Mantid
Loading...
Searching...
No Matches
AlternateCSPythonLexer.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8
13AlternateCSPythonLexer::AlternateCSPythonLexer(const QFont &font) : QsciLexerPython(), m_font(font) {}
14
20QColor AlternateCSPythonLexer::defaultColor(int style) const {
21 switch (style) {
22 case Default:
23 return QColor(0x00, 0x00, 0x00);
24
25 case Comment:
26 return QColor(0xad, 0xad, 0xad);
27
28 case Number:
29 return QColor(0x80, 0x00, 0x00);
30
31 case DoubleQuotedString:
32 case SingleQuotedString:
33 return QColor(0x00, 0xaa, 0x00);
34
35 case Keyword:
36 return QColor(0x00, 0x00, 0xff);
37
38 case TripleSingleQuotedString:
39 case TripleDoubleQuotedString:
40 return QColor(0x00, 0xaa, 0x00);
41
42 case ClassName:
43 return QColor(0x00, 0x00, 0x00);
44
45 case FunctionMethodName:
46 return QColor(0x00, 0x7f, 0x7f);
47
48 case Operator:
49 case Identifier:
50 break;
51
52 case CommentBlock:
53 return QColor(0xad, 0xad, 0xad);
54
55 case UnclosedString:
56 return QColor(0x00, 0x00, 0x00);
57
58 case HighlightedIdentifier:
59 return QColor(0x40, 0x70, 0x90);
60
61 case Decorator:
62 return QColor(0x80, 0x50, 0x00);
63 }
64
65 return QsciLexer::defaultColor(style);
66}
67
74 Q_UNUSED(style);
75 return m_font;
76}
QColor defaultColor(int style) const override
Returns the foreground colour of the text for a style.
AlternateCSPythonLexer(const QFont &font)
Construct a lexer with a font to be used for all text styles.
QFont defaultFont(int style) const override
Returns the font of the text.