Navigator2Go  2.0
Manage your local Ocean Navigator installation.
htmlhighlighter.h
1 #ifndef HTMLHIGHLIGHTER_H
2 #define HTMLHIGHLIGHTER_H
3 
4 #include <QSyntaxHighlighter>
5 
6 class HTMLHighlighter : public QSyntaxHighlighter {
7  Q_OBJECT
8 
9 public:
10  explicit HTMLHighlighter(QTextDocument* parent = nullptr);
11 
12 protected:
13  void highlightBlock(const QString& text) Q_DECL_OVERRIDE;
14 
15 private:
16  // Status highlighting, which is a text box at the time of its closure
17  enum States {
18  None,
19  Tag,
20  Comment,
21  Quote
22  };
23 
25  QRegExp pattern;
26  QTextCharFormat format;
27  };
28  QVector<HighlightingRule> m_startTagRules; // Formatting rules for opening tag
29  QVector<HighlightingRule> m_endTagRules; // Formatting rules for closing tags
30 
31  QRegExp m_openTag; // opening tag symbol - "<"
32  QRegExp m_closeTag; // closing symbol tag - ">"
33  QTextCharFormat m_edgeTagFormat; // character formatting of openTag and closeTag
34  QTextCharFormat m_insideTagFormat; // Formatting text inside the tag
35 
36  QRegExp m_commentStartExpression; // Regular expression of start comment
37  QRegExp m_commentEndExpression; // Redular expression of end comment
38  QTextCharFormat m_multiLineCommentFormat; // Format text inside a comment
39 
40  QRegExp m_quotes; // Regular Expression for text in quotes inside the tag
41  QTextCharFormat m_quotationFormat; // Formatting text in quotes inside the tag
42  QTextCharFormat m_tagsFormat; // Formatting tags themselves
43 };
44 
45 #endif // HTMLHIGHLIGHTER_H
Definition: htmlhighlighter.h:6
Definition: htmlhighlighter.h:24
void highlightBlock(const QString &text) Q_DECL_OVERRIDE
Definition: htmlhighlighter.cpp:100