📄 htmlsyntaxhighlighter.h
字号:
#ifndef HTMLSYNTAXHIGHLIGHTER_H#define HTMLSYNTAXHIGHLIGHTER_H#include <QSyntaxHighlighter>class HtmlSyntaxHighlighter : public QSyntaxHighlighter{ Q_OBJECTpublic: enum Construct { Entity, Tag, Comment, LastConstruct = Comment }; HtmlSyntaxHighlighter(QTextDocument *document); void setFormatFor(Construct construct, const QTextCharFormat &format); void setFormatFor(Construct construct, const QColor &color); void setFormatFor(Construct construct, const QFont &font); QTextCharFormat formatFor(Construct construct) const { return formats[construct]; }protected: enum State { NormalState = -1, InComment, InTag }; void highlightBlock(const QString &text);private: QTextCharFormat formats[LastConstruct + 1];};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -