def __init__(self, parent=None):
super(FeatureCodeHighlighter, self).__init__(parent)
keywordFormat = QTextCharFormat()
keywordFormat.setForeground(QColor(45, 95, 235))
self.addRule("\\b(?<!\\\\)(%s)\\b" % ("|".join(keywordPatterns)),
keywordFormat)
singleLineCommentFormat = QTextCharFormat()
singleLineCommentFormat.setForeground(QColor(112, 128, 144))
self.addRule("#[^\n]*", singleLineCommentFormat)
groupFormat = QTextCharFormat()
groupFormat.setForeground(QColor(255, 27, 147))
self.addRule("@[A-Za-z0-9_.]+", groupFormat)
评论列表
文章目录