Last change
on this file since 1074 was 1073, checked in by s10k, 7 years ago |
added XML Tools latest version (2.0d) and s10k's common libs
|
File size:
557 bytes
|
Line | |
---|
1 | #ifndef HIGHLIGHTER_H
|
---|
2 | #define HIGHLIGHTER_H
|
---|
3 |
|
---|
4 | #include <QSyntaxHighlighter>
|
---|
5 | #include <QTextCharFormat>
|
---|
6 |
|
---|
7 | // Downloaded from here:
|
---|
8 | // https://github.com/isomoar/json-editor/blob/master/syntaxhighlightening/highlighter.cpp
|
---|
9 |
|
---|
10 | class Highlighter: public QSyntaxHighlighter
|
---|
11 | {
|
---|
12 | public:
|
---|
13 | Highlighter(QTextDocument *parent = 0);
|
---|
14 | private:
|
---|
15 | struct HighlightingRule
|
---|
16 | {
|
---|
17 | QRegExp pattern;
|
---|
18 | QTextCharFormat format;
|
---|
19 | };
|
---|
20 | QVector<HighlightingRule> rules;
|
---|
21 |
|
---|
22 |
|
---|
23 | protected:
|
---|
24 | void highlightBlock(const QString &text);
|
---|
25 | };
|
---|
26 |
|
---|
27 | #endif // HIGHLIGHTER_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.