source: s10k/CommonLibs/jsonhighlighter/highlighter.h@ 1121

Last change on this file since 1121 was 1110, checked in by s10k, 6 years ago

slightly modifications to allow subclassing, added Q_OBJECT macro, since usually all classes derived from QObject should use it

File size: 597 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
10class Highlighter: public QSyntaxHighlighter
11{
12 Q_OBJECT
13public:
14 Highlighter(QTextDocument *parent = 0);
15protected:
16 struct HighlightingRule
17 {
18 QRegExp pattern;
19 QTextCharFormat format;
20 };
21 QVector<HighlightingRule> rules;
22
23
24protected:
25 void highlightBlock(const QString &text);
26};
27
28#endif // HIGHLIGHTER_H
Note: See TracBrowser for help on using the repository browser.