-
Notifications
You must be signed in to change notification settings - Fork 3
/
editHighLighter.h
49 lines (39 loc) · 1016 Bytes
/
editHighLighter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef EDIT_HIGHLIGHTER_H
#define EDIT_HIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QHash>
#include <QTextCharFormat>
QT_BEGIN_NAMESPACE
class QTextDocument;
QT_END_NAMESPACE
class ModelSchema;
//! [0]
class EditHighLighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
EditHighLighter(QTextDocument *parent = 0);
void setColumHeaders(QStringList &ch);
protected:
void highlightBlock(const QString &text);
private:
struct HighlightingRule
{
QRegExp pattern;
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;
QRegExp commentStartExpression;
QRegExp commentEndExpression;
QRegExp headerFormat;
QTextCharFormat keywordFormat;
QTextCharFormat variableFormat;
QTextCharFormat badVariableFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
QStringList columnHeaders;
};
//! [0]
#endif