[PyQt] Feature request: give QsyntaxHighlighter access to the global offset

Henning Schröder post at henning-schroeder.de
Mon Feb 9 16:28:00 GMT 2009


2009/2/9 Edward K. Ream <edreamleo at gmail.com>:
> For my app, there is a lamentable hole in the QSyntaxHighlighter interface.  My app has been able to work around this hole, but it would be *so* much better if the hole could be plugged.
>
> The problem is that QSyntaxHighlighter.highlightBlock is passed only the string to be colored, *not* the offset of that string in the entire text.
>
Since Qt 4.4 there is QSyntaxHighligher.currentBlock()
You should be able to use QTextBlock.postion() then to get the offset

Greets
Henning


More information about the PyQt mailing list