I want something like the following example:
User start to type in QTextDocument "abc" I want change it to "ABC" and send it to QTextDocument so all other part of QTextDocument API like syntax-highlighting and text layouting should get "ABC" and not "abc".

I didn't find a method about this so I used QTextDocument::contentsChange() signal to detect new added chars and then preprocess them (in this example apply toUpper()) but this is dirty and QAbstractTextDocumentLayout::documentChanged() will be called twice.

Any idea?