opencv_mv/QPlugins/LogicalTools/ScriptEdit/highlighter.h

33 lines
732 B
C
Raw Permalink Normal View History

2023-05-22 09:27:46 +00:00
#pragma once
#include <QSyntaxHighlighter>
#include <QRegularExpression>
class Highlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
Highlighter(QTextDocument* parent = 0);
protected:
void highlightBlock(const QString& text) override;
private:
struct HighlightingRule
{
QRegularExpression pattern;
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;
QRegularExpression commentStartExpression;
QRegularExpression commentEndExpression;
QTextCharFormat keywordFormat;
QTextCharFormat preprocessorFormat;
QTextCharFormat classFormat;
QTextCharFormat singleLineCommentFormat;
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
};