Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
据我所知,我必须继承QSyntaxHighlighter和覆盖highlightBlock()才能为我的QTextEdit.
QSyntaxHighlighter
highlightBlock()
QTextEdit
但是,我只能QString进入highlightBlock(). 该字符串不包含有关它在该文档中的位置的任何信息。如果我只想在文档的奇数行中突出显示文本,我该怎么办?
QString
QSyntaxHighlighter 有这个
protected: QTextBlock currentBlock() const;
在哪里可以找到blockNumber()
blockNumber()