summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/doc_src_richtext.qdoc
blob: d6f54c29c3c3d6441295050bd945df8db8c7ce68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! [0]
QTextDocument *newDocument = new QTextDocument;
//! [0]


//! [1]
QTextEdit *editor = new QTextEdit;
QTextDocument *editorDocument = editor->document();
//! [1]


//! [2]
QTextEdit *editor = new QTextEdit(parent);
editor->setHtml(aStringContainingHTMLtext);
editor->show();
//! [2]


//! [3]
QTextDocument *document = editor->document();
//! [3]


//! [4]
QTextCursor cursor = editor->textCursor();
//! [4]


//! [5]
editor->setTextCursor(cursor);
//! [5]


//! [6]
textEdit.show();

textCursor.beginEditBlock();

for (int i = 0; i < 1000; ++i) {
    textCursor.insertBlock();
    textCursor.insertText(paragraphText.at(i));
}

textCursor.endEditBlock(); 
//! [6]


//! [7]
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
//! [7]