Hello,

you suggest to use QTextBlockUserData:

"Alternatively you could use QTextBlockUserData to store your line numbering information and the block state to control the range of highlighting"

But how can I know line numbering? I miss a previousBlockUserData() method to get the user data of previous block and so infere line number of current block.

I would need to loop across all document blocks and create corresponding used data object _before_ and _outside_ my highlightBlock() reimplementation where I could just read the currentBlockUserData(). it does not seem easier nor faster.

Marco

P.S: Thanks for your QCodeEdit class, I will take a look although I suspect it's overkill for my needs. I just need to highlight chunks of a read-only document according to a range given in line numbers.