3

As far as I know, I have to inherit from QSyntaxHighlighter and and override highlightBlock() to make a highlighter for my QTextEdit.

However, I can only get a QString in highlightBlock(). The string does not contain any information about where it is in that document. How can I do if I want to highlight the text only in odd lines of the document?

László Papp
  • 51,870
  • 39
  • 111
  • 135

1 Answers1

2

QSyntaxHighlighter has this

protected:
QTextBlock currentBlock() const;

where you can find blockNumber()

CapelliC
  • 59,646
  • 5
  • 47
  • 90