1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/text/qtextobject.cpp -->
7
<title>Qt 4.0: QTextBlock Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QTextBlock Class Reference</h1>
21
<p>The QTextBlock class provides a container for text fragments in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
22
<pre>#include <QTextBlock></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
24
<li><a href="qtextblock-members.html">List of all members, including inherited members</a></li>
26
<a name="public-types"></a>
29
<li><div class="fn"/>class <b><a href="qtextblock-iterator.html">iterator</a></b></li>
30
<li><div class="fn"/>typedef <b><a href="qtextblock.html#Iterator-typedef">Iterator</a></b></li>
32
<a name="public-functions"></a>
33
<h3>Public Functions</h3>
35
<li><div class="fn"/><b><a href="qtextblock.html#QTextBlock-3">QTextBlock</a></b> ( const QTextBlock & <i>other</i> )</li>
36
<li><div class="fn"/>iterator <b><a href="qtextblock.html#begin">begin</a></b> () const</li>
37
<li><div class="fn"/>QTextBlockFormat <b><a href="qtextblock.html#blockFormat">blockFormat</a></b> () const</li>
38
<li><div class="fn"/>int <b><a href="qtextblock.html#blockFormatIndex">blockFormatIndex</a></b> () const</li>
39
<li><div class="fn"/>QTextCharFormat <b><a href="qtextblock.html#charFormat">charFormat</a></b> () const</li>
40
<li><div class="fn"/>int <b><a href="qtextblock.html#charFormatIndex">charFormatIndex</a></b> () const</li>
41
<li><div class="fn"/>bool <b><a href="qtextblock.html#contains">contains</a></b> ( int <i>position</i> ) const</li>
42
<li><div class="fn"/>const QTextDocument * <b><a href="qtextblock.html#document">document</a></b> () const</li>
43
<li><div class="fn"/>iterator <b><a href="qtextblock.html#end">end</a></b> () const</li>
44
<li><div class="fn"/>bool <b><a href="qtextblock.html#isValid">isValid</a></b> () const</li>
45
<li><div class="fn"/>QTextLayout * <b><a href="qtextblock.html#layout">layout</a></b> () const</li>
46
<li><div class="fn"/>int <b><a href="qtextblock.html#length">length</a></b> () const</li>
47
<li><div class="fn"/>QTextBlock <b><a href="qtextblock.html#next">next</a></b> () const</li>
48
<li><div class="fn"/>int <b><a href="qtextblock.html#position">position</a></b> () const</li>
49
<li><div class="fn"/>QTextBlock <b><a href="qtextblock.html#previous">previous</a></b> () const</li>
50
<li><div class="fn"/>QString <b><a href="qtextblock.html#text">text</a></b> () const</li>
51
<li><div class="fn"/>QTextList * <b><a href="qtextblock.html#textList">textList</a></b> () const</li>
52
<li><div class="fn"/>bool <b><a href="qtextblock.html#operator-not-eq">operator!=</a></b> ( const QTextBlock & <i>other</i> ) const</li>
53
<li><div class="fn"/>bool <b><a href="qtextblock.html#operator-lt">operator<</a></b> ( const QTextBlock & <i>other</i> ) const</li>
54
<li><div class="fn"/>QTextBlock & <b><a href="qtextblock.html#operator-eq">operator=</a></b> ( const QTextBlock & <i>other</i> )</li>
55
<li><div class="fn"/>bool <b><a href="qtextblock.html#operator-eq-eq">operator==</a></b> ( const QTextBlock & <i>other</i> ) const</li>
57
<a name="details"></a>
59
<h2>Detailed Description</h2>
60
<p>The QTextBlock class provides a container for text fragments in a <a href="qtextdocument.html">QTextDocument</a>.</p>
61
<p>A text block encapsulates a block or paragraph of text in a <a href="qtextdocument.html">QTextDocument</a>. QTextBlock provides read-only access to the block/paragraph structure of QTextDocuments. It is mainly of use if you want to implement your own layouts for the visual representation of a <a href="qtextdocument.html">QTextDocument</a>, or if you want to iterate over a document and write out the contents in your own custom format.</p>
62
<p>Text blocks are created by their parent documents. If you need to create a new text block, use the cursor-based interface provided by <a href="qtextcursor.html">QTextCursor</a>.</p>
63
<p>Each text block is located at a specific <a href="qtextblock.html#position">position</a>() in a <a href="qtextblock.html#document">document</a>(). The contents of the block can be obtained by using the <a href="qtextblock.html#text">text</a>() function. The <a href="qtextblock.html#length">length</a>() function determines the block's size within the document (including formatting characters). The visual properties of the block are determined by its text <a href="qtextblock.html#layout">layout</a>(), its <a href="qtextblock.html#charFormat">charFormat</a>(), and its <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>
64
<p>The <a href="qtextblock.html#next">next</a>() and <a href="qtextblock.html#previous">previous</a>() functions allow navigation between blocks within the document. Note that blocks are returned in sequence, so adjacent blocks may come from different places in the document structure.</p>
65
<p>QTextBlock provides comparison operators two make it easier to work with blocks: operator==() compares two block for equality, operator!=() compares two blocks for inequality, and operator<() determines whether a block precedes another in the same document.</p>
66
<center><img src="images/qtextblock-sequence.png" /></center><p>See also <a href="qtextblockformat.html">QTextBlockFormat</a>, <a href="qtextcharformat.html">QTextCharFormat</a>, and <a href="qtextfragment.html">QTextFragment</a>.</p>
68
<h2>Member Type Documentation</h2>
69
<h3 class="fn"><a name="Iterator-typedef"></a>typedef QTextBlock::Iterator</h3>
70
<p>Qt-style synonym for <a href="qtextblock-iterator.html">QTextBlock::iterator</a>.</p>
72
<h2>Member Function Documentation</h2>
73
<h3 class="fn"><a name="QTextBlock-3"></a>QTextBlock::QTextBlock ( const QTextBlock & <i>other</i> )</h3>
74
<p>Copies the <i>other</i> text block's attributes to this text block.</p>
75
<h3 class="fn"><a name="begin"></a><a href="qtextblock-iterator.html">iterator</a> QTextBlock::begin () const</h3>
76
<p>Returns a text block iterator pointing to the beginning of the text block.</p>
77
<p>See also <a href="qtextblock.html#end">end</a>().</p>
78
<h3 class="fn"><a name="blockFormat"></a><a href="qtextblockformat.html">QTextBlockFormat</a> QTextBlock::blockFormat () const</h3>
79
<p>Returns the <a href="qtextblockformat.html">QTextBlockFormat</a> that describes block-specific properties.</p>
80
<p>See also <a href="qtextblock.html#charFormat">charFormat</a>().</p>
81
<h3 class="fn"><a name="blockFormatIndex"></a>int QTextBlock::blockFormatIndex () const</h3>
82
<p>Returns an index into the document's internal list of block formats for the text block's format.</p>
83
<p>See also <a href="qtextdocument.html#object">QTextDocument::object</a>().</p>
84
<h3 class="fn"><a name="charFormat"></a><a href="qtextcharformat.html">QTextCharFormat</a> QTextBlock::charFormat () const</h3>
85
<p>Returns the <a href="qtextcharformat.html">QTextCharFormat</a> that describes the block's character format. This is mainly used to draw block-specific additions such as e.g. list markers.</p>
86
<p>See also <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>
87
<h3 class="fn"><a name="charFormatIndex"></a>int QTextBlock::charFormatIndex () const</h3>
88
<p>Returns an index into the document's internal list of character formats for the text block's character format.</p>
89
<p>See also <a href="qtextdocument.html#object">QTextDocument::object</a>().</p>
90
<h3 class="fn"><a name="contains"></a>bool QTextBlock::contains ( int <i>position</i> ) const</h3>
91
<p>Returns true if the given <i>position</i> is located within the text block; otherwise returns false.</p>
92
<h3 class="fn"><a name="document"></a>const <a href="qtextdocument.html">QTextDocument</a> * QTextBlock::document () const</h3>
93
<p>Returns the text document this text block belongs to, or 0 if the text block does not belong to any document.</p>
94
<h3 class="fn"><a name="end"></a><a href="qtextblock-iterator.html">iterator</a> QTextBlock::end () const</h3>
95
<p>Returns a text block iterator pointing to the end of the text block.</p>
96
<p>See also <a href="qtextblock.html#begin">begin</a>(), <a href="qtextblock.html#next">next</a>(), and <a href="qtextblock.html#previous">previous</a>().</p>
97
<h3 class="fn"><a name="isValid"></a>bool QTextBlock::isValid () const</h3>
98
<p>Returns true if this text block is valid; otherwise returns false.</p>
99
<h3 class="fn"><a name="layout"></a><a href="qtextlayout.html">QTextLayout</a> * QTextBlock::layout () const</h3>
100
<p>Returns the <a href="qtextlayout.html">QTextLayout</a> that is used to lay out and display the block's contents.</p>
101
<h3 class="fn"><a name="length"></a>int QTextBlock::length () const</h3>
102
<p>Returns the length of the block in characters.</p>
103
<p>See also <a href="qtextblock.html#text">text</a>(), <a href="qtextblock.html#charFormat">charFormat</a>(), and <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>
104
<h3 class="fn"><a name="next"></a>QTextBlock QTextBlock::next () const</h3>
105
<p>Returns the text block in the document after this block, or an empty text block if this is the last one.</p>
106
<p>Note that the next block may be in a different frame or table to this block.</p>
107
<p>See also <a href="qtextblock.html#previous">previous</a>(), <a href="qtextblock.html#begin">begin</a>(), and <a href="qtextblock.html#end">end</a>().</p>
108
<h3 class="fn"><a name="position"></a>int QTextBlock::position () const</h3>
109
<p>Returns the starting position of the block within the document.</p>
110
<h3 class="fn"><a name="previous"></a>QTextBlock QTextBlock::previous () const</h3>
111
<p>Returns the text block in the document before this block, or an empty text block if this is the first one.</p>
112
<p>Note that the next block may be in a different frame or table to this block.</p>
113
<p>See also <a href="qtextblock.html#next">next</a>(), <a href="qtextblock.html#begin">begin</a>(), and <a href="qtextblock.html#end">end</a>().</p>
114
<h3 class="fn"><a name="text"></a><a href="qstring.html">QString</a> QTextBlock::text () const</h3>
115
<p>Returns the block's contents as plain text.</p>
116
<p>See also <a href="qtextblock.html#length">length</a>(), <a href="qtextblock.html#charFormat">charFormat</a>(), and <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>
117
<h3 class="fn"><a name="textList"></a><a href="qtextlist.html">QTextList</a> * QTextBlock::textList () const</h3>
118
<p>If the block represents a list item, returns the list that the item belongs to; otherwise returns 0.</p>
119
<h3 class="fn"><a name="operator-not-eq"></a>bool QTextBlock::operator!= ( const QTextBlock & <i>other</i> ) const</h3>
120
<p>Returns true if this text block is different from the <i>other</i> text block.</p>
121
<h3 class="fn"><a name="operator-lt"></a>bool QTextBlock::operator< ( const QTextBlock & <i>other</i> ) const</h3>
122
<p>Returns true if this text block occurs before the <i>other</i> text block in the document.</p>
123
<h3 class="fn"><a name="operator-eq"></a>QTextBlock & QTextBlock::operator= ( const QTextBlock & <i>other</i> )</h3>
124
<p>Assigns the <i>other</i> text block to this text block.</p>
125
<h3 class="fn"><a name="operator-eq-eq"></a>bool QTextBlock::operator== ( const QTextBlock & <i>other</i> ) const</h3>
126
<p>Returns true if this text block is the same as the <i>other</i> text block.</p>
127
<p /><address><hr /><div align="center">
128
<table width="100%" cellspacing="0" border="0"><tr class="address">
129
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
130
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
131
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
132
</tr></table></div></address></body>