11int main(
int argc,
char *argv[])
24 redFormat.setForeground(
Qt::red);
28 redCursor.setCharFormat(redFormat);
29 blueCursor.setCharFormat(blueFormat);
31 for (
int i = 0;
i < 20; ++
i) {
33 redCursor.insertText(
tr(
"%1 ").
arg(
i), redFormat);
35 blueCursor.insertText(
tr(
"%1 ").
arg(
i), blueFormat);
38 editor->setWindowTitle(
tr(
"Text Document Cursors"));
39 editor->resize(320, 480);
\reentrant \inmodule QtGui
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
QTextDocument * document
the underlying document of the text editor.