Krita Source Code Documentation
Loading...
Searching...
No Matches
BasicXMLSyntaxHighlighter.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Ivanov
3 *
4 * SPDX-License-Identifier: MIT
5 */
6#ifndef BASIC_XML_SYNTAX_HIGHLIGHTER_H
7#define BASIC_XML_SYNTAX_HIGHLIGHTER_H
8
9#include <QSyntaxHighlighter>
10#include <QTextEdit>
11#include <QRegExp>
12
24class BasicXMLSyntaxHighlighter : public QSyntaxHighlighter
25{
26 Q_OBJECT
27public:
28 BasicXMLSyntaxHighlighter(QObject * parent);
29 BasicXMLSyntaxHighlighter(QTextDocument * parent);
30 BasicXMLSyntaxHighlighter(QTextEdit * parent);
31
32 void setFormats();
33
34protected:
35 void highlightBlock(const QString &text) override;
36
37private:
38 void highlightByRegex(const QTextCharFormat & format,
39 const QRegExp & regex, const QString & text);
40
41 void setRegexes();
42
43
44private:
45 QTextCharFormat m_xmlKeywordFormat;
46 QTextCharFormat m_xmlElementFormat;
47 QTextCharFormat m_xmlAttributeFormat;
48 QTextCharFormat m_xmlValueFormat;
49 QTextCharFormat m_xmlCommentFormat;
50
56};
57
58#endif // BASIC_XML_SYNTAX_HIGHLIGHTER_H
void highlightByRegex(const QTextCharFormat &format, const QRegExp &regex, const QString &text)
void highlightBlock(const QString &text) override