KSeExpr  4.0.4.0
ExprHighlighter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2011-2019 Disney Enterprises, Inc.
2 // SPDX-License-Identifier: LicenseRef-Apache-2.0
3 // SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 /*
6  * @file ExprHighlighter.h
7  * @brief A Qt syntax highlighter for the SeExpr language
8  * @author aselle, amyspark
9  */
10 
11 #pragma once
12 
13 #include <QPalette>
14 #include <QSyntaxHighlighter>
15 #include <QTextDocument>
16 #include <QTextEdit>
17 
18 
19 class ExprHighlighter : public QSyntaxHighlighter
20 {
22  QRegExp pattern;
23  QTextCharFormat format;
24  };
25  QVector<HighlightingRule> highlightingRules;
26  QTextCharFormat singleLineCommentFormat;
27  QTextCharFormat variableFormat;
28  QTextCharFormat numberFormat;
29  QTextCharFormat operatorFormat;
30 
31  int lightness;
32 
33 public:
34  ExprHighlighter(QTextDocument *parent);
35  ExprHighlighter(QTextEdit *edit);
36 
37  void fixStyle(const QPalette &palette);
38 
39  void init();
40  void highlightBlock(const QString &text) override;
41 };
void fixStyle(const QPalette &palette)
QTextCharFormat numberFormat
QTextCharFormat operatorFormat
ExprHighlighter(QTextDocument *parent)
QTextCharFormat variableFormat
void highlightBlock(const QString &text) override
QVector< HighlightingRule > highlightingRules
QTextCharFormat singleLineCommentFormat