Hi!

It is possible to change a QTextBlock's QTextCharFormat in a QTextEdit by calling
myTextBlock.layout()->setAdditionalFormats(myFormats);
where myFormats is a QList<QTextLayout::FormatRange>

If I also want to change a QTextBlock's QTextBlockFormat the only solution I found is to take a QTextCursor, e.g.
myTextCursor.setPositon(positionInMyTextBlock);
myTextCursor.setBlockFormat(myTextBlockFormat);
(Actually I only want to add a topMargin...)

I want to use this within a highlighting algorithm. So the problem is that the cursor operations are added to the "undo list" of the QTextEdit.

So is there a possibility to set a QTextBlockFormat not using the QTextCursor but directly adding it to the QTextEdit or QTextDocument (QTextDocument even has QVector<QTextFormat> QTextDocument::allFormats(), but no setter)?
Or is it possible to unable undo of the QTextEdit before I change the QtextCursor and enable it afterwards?

Thanks for reply!