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

dboddie at trolltech.com dboddie at trolltech.com
Mon Feb 9 15:06:24 GMT 2009

On Mon Feb 9 14:41:06 GMT 2009, Edward K. Ream wrote:

> 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.

I was going to point out that you can get the offset of the text because you
have access to the QTextBlock that contains the text, then I realised that
the Syntax Highlighter example shipped with PyQt uses a different mechanism
that predates the QSyntaxHighlighter class from Qt 4.1. (The example is also
broken, but that's another story.)

I think you need to report this deficiency in the API in the form of a
feature request to Qt Software:



More information about the PyQt mailing list