39 #ifndef PYTHONCODEHIGHLIGHTER_H_
40 #define PYTHONCODEHIGHLIGHTER_H_
42 #include <QSyntaxHighlighter>
45 #include <QTextCharFormat>
49 class PythonCodeHighlighter :
public QSyntaxHighlighter {
51 struct HighlightingRule {
53 QTextCharFormat format;
56 QVector<HighlightingRule> _highlightingRules;
57 QTextCharFormat _keywordFormat;
58 QTextCharFormat _classFormat;
59 QTextCharFormat _commentFormat;
60 QTextCharFormat _quotationFormat;
61 QTextCharFormat _functionFormat;
62 QTextCharFormat _numberFormat;
63 QTextCharFormat _tlpApiFormat;
64 QTextCharFormat _qtApiFormat;
70 explicit PythonCodeHighlighter(QTextDocument *parent = 0);
72 void setShellMode(
const bool shellMode) {
73 _shellMode = shellMode;
78 void highlightBlock(
const QString &text);