htmlsyntaxhighlighter.h
来自「QT4 gui programming的随书光盘」· C头文件 代码 · 共 43 行
H
43 行
#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 + =
减小字号Ctrl + -
显示快捷键?