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.
私の知る限り、 and から継承しQSyntaxHighlighter、オーバーライドhighlightBlock()して、 のハイライターを作成する必要がありますQTextEdit。
QSyntaxHighlighter
highlightBlock()
QTextEdit
QStringしかし、私はでしか取得できませんhighlightBlock()。文字列には、そのドキュメント内の場所に関する情報は含まれていません。ドキュメントの奇数行のテキストのみを強調表示したい場合はどうすればよいですか?
QString
QSyntaxHighlighterにはこれがあります
protected: QTextBlock currentBlock() const;
どこで見つけることができますかblockNumber()
blockNumber()