QTextCursor cursor = textDocument->textCursor(); QTextBlockFormat blockFormat; blockFormat.setAlignment(Qt::AlignCenter); cursor.mergeBlockFormat(blockFormat);
QTextCursor cursor = textDocument->textCursor(); QTextBlockFormat blockFormat; blockFormat.clear(); cursor.mergeBlockFormat(blockFormat);In this example, the cursor's current block format will be reset to default values. Both of these examples use the QTextCursor class from the Qt C++ library.