27 cursor.setBlockFormat(blockFormat);
28 cursor.insertText(
tr(
"This contains plain text inside a "
29 "text block with margins to keep it separate "
30 "from other parts of the document."));
38 cursor.setBlockFormat(backgroundFormat);
40 cursor.insertText(
tr(
"The background color of a text block can be "
41 "changed to highlight text."));
48 cursor.setBlockFormat(rightAlignedFormat);
49 cursor.insertText(
tr(
"The alignment of the text within a block is "
50 "controlled by the alignment properties of "
51 "the block itself. This text block is "
58 paragraphFormat.setTextIndent(32);
60 cursor.setBlockFormat(paragraphFormat);
61 cursor.insertText(
tr(
"Text can be formatted so that the first "
62 "line in a paragraph has its own margin. "
63 "This makes the text more readable."));
69 reverseFormat.setTextIndent(32);
71 cursor.setBlockFormat(reverseFormat);
72 cursor.insertText(
tr(
"The direction of the text can be reversed. "
73 "This is useful for right-to-left "
76 editor->setWindowTitle(
tr(
"Text Block Formats"));
77 editor->resize(480, 480);
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.