initial upload

This commit is contained in:
2023-11-15 20:54:49 +01:00
parent b90a34c4b4
commit 99dad98ce0
29 changed files with 1277 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef HTMLHIGHLIGHTER_H
#define HTMLHIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
#include <QTextEdit>
/* HTML syntax highlighter based on Qt Quarterly example */
class HtmlHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
enum Construct {
Entity,
Tag,
Comment,
Attribute,
Value,
LastConstruct = Value
};
HtmlHighlighter(QTextEdit *textEdit);
void setFormatFor(Construct construct, const QTextCharFormat &format);
QTextCharFormat formatFor(Construct construct) const
{ return m_formats[construct]; }
protected:
enum State {
NormalState = -1,
InComment,
InTag
};
void highlightBlock(const QString &text) override;
private:
QTextCharFormat m_formats[LastConstruct + 1];
};
#endif // HTMLHIGHLIGHTER_H