I don't understand. I setup char format, block format, root frame format, and page size for all of the text in QTextEdit control. And then if I manually delete all the text, and start to type new one, or if I select all text and paste new one from buffer, then voilà! - all the formatting loses.
Is it possible to set some default format for QTextEdit (char's, block's, page, etc.)?
I've solved it the next way.
Handled QTextEdit::currentCharFormatChanged signal(as vahancho promted), and call QTextEdit::setTextCursor with needed formatting cursor. It solves the problem with char and block format.
For the pageSize and rootFrame's format, I've handled QTextEdit::document::documentLayout's update signal and if rootFrame format or pageSize of the document was changed, then resetup the needed sizes again.