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/qtextformat.cpp -->
7
<title>Qt 4.0: QTextBlockFormat 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">QTextBlockFormat Class Reference</h1>
21
<p>The QTextBlockFormat class provides formatting information for blocks of text in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
22
<pre>#include <QTextBlockFormat></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
23
<p>Inherits <a href="qtextformat.html">QTextFormat</a>.</p>
25
<li><a href="qtextblockformat-members.html">List of all members, including inherited members</a></li>
27
<a name="public-functions"></a>
28
<h3>Public Functions</h3>
30
<li><div class="fn"/><b><a href="qtextblockformat.html#QTextBlockFormat">QTextBlockFormat</a></b> ()</li>
31
<li><div class="fn"/>Qt::Alignment <b><a href="qtextblockformat.html#alignment">alignment</a></b> () const</li>
32
<li><div class="fn"/>qreal <b><a href="qtextblockformat.html#bottomMargin">bottomMargin</a></b> () const</li>
33
<li><div class="fn"/>int <b><a href="qtextblockformat.html#indent">indent</a></b> () const</li>
34
<li><div class="fn"/>bool <b><a href="qtextblockformat.html#isValid">isValid</a></b> () const</li>
35
<li><div class="fn"/>qreal <b><a href="qtextblockformat.html#leftMargin">leftMargin</a></b> () const</li>
36
<li><div class="fn"/>bool <b><a href="qtextblockformat.html#nonBreakableLines">nonBreakableLines</a></b> () const</li>
37
<li><div class="fn"/>qreal <b><a href="qtextblockformat.html#rightMargin">rightMargin</a></b> () const</li>
38
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setAlignment">setAlignment</a></b> ( Qt::Alignment <i>alignment</i> )</li>
39
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a></b> ( qreal <i>margin</i> )</li>
40
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setIndent">setIndent</a></b> ( int <i>indentation</i> )</li>
41
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a></b> ( qreal <i>margin</i> )</li>
42
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a></b> ( bool <i>b</i> )</li>
43
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setRightMargin">setRightMargin</a></b> ( qreal <i>margin</i> )</li>
44
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setTextIndent">setTextIndent</a></b> ( qreal <i>indent</i> )</li>
45
<li><div class="fn"/>void <b><a href="qtextblockformat.html#setTopMargin">setTopMargin</a></b> ( qreal <i>margin</i> )</li>
46
<li><div class="fn"/>qreal <b><a href="qtextblockformat.html#textIndent">textIndent</a></b> () const</li>
47
<li><div class="fn"/>qreal <b><a href="qtextblockformat.html#topMargin">topMargin</a></b> () const</li>
50
<li><div class="fn"/>46 public functions inherited from <a href="qtextformat.html#public-functions">QTextFormat</a></li>
52
<a name="details"></a>
54
<h2>Detailed Description</h2>
55
<p>The QTextBlockFormat class provides formatting information for blocks of text in a <a href="qtextdocument.html">QTextDocument</a>.</p>
56
<p>A document is composed of a list of blocks. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.</p>
57
<p>To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with <a href="qtextblockformat.html#setAlignment">setAlignment</a>(). Margins are controlled by <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>(). Overall indentation is set with <a href="qtextblockformat.html#setIndent">setIndent</a>(), the indentation of the first line with <a href="qtextblockformat.html#setTextIndent">setTextIndent</a>().</p>
58
<p>Line breaking can be enabled and disabled with <a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a>().</p>
59
<p>The brush used to paint the paragraph's background is set with <a href="qtextformat.html#setBackground">setBackground()</a>, and other aspects of the text's appearance can be customized by using the <a href="qtextformat.html#setProperty">setProperty()</a> function with the <tt>OutlinePen</tt>, <tt>ForegroundBrush</tt>, and <tt>BackgroundBrush</tt> <a href="qtextformat.html#Property-enum">QTextFormat::Property</a> values.</p>
60
<p>If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.</p>
61
<p>See also <a href="qtextcharformat.html">QTextCharFormat</a>.</p>
63
<h2>Member Function Documentation</h2>
64
<h3 class="fn"><a name="QTextBlockFormat"></a>QTextBlockFormat::QTextBlockFormat ()</h3>
65
<p>Constructs a new <a href="qtextblockformat.html">QTextBlockFormat</a>.</p>
66
<h3 class="fn"><a name="alignment"></a><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> QTextBlockFormat::alignment () const</h3>
67
<p>Returns the paragraph's alignment.</p>
68
<p>See also <a href="qtextblockformat.html#setAlignment">setAlignment</a>().</p>
69
<h3 class="fn"><a name="bottomMargin"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextBlockFormat::bottomMargin () const</h3>
70
<p>Returns the paragraph's bottom margin.</p>
71
<p>See also <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>() and <a href="qtextblockformat.html#topMargin">topMargin</a>().</p>
72
<h3 class="fn"><a name="indent"></a>int QTextBlockFormat::indent () const</h3>
73
<p>Returns the paragraph's indent.</p>
74
<p>See also <a href="qtextblockformat.html#setIndent">setIndent</a>().</p>
75
<h3 class="fn"><a name="isValid"></a>bool QTextBlockFormat::isValid () const</h3>
76
<p>Returns true if this block format is valid; otherwise returns false.</p>
77
<h3 class="fn"><a name="leftMargin"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextBlockFormat::leftMargin () const</h3>
78
<p>Returns the paragraph's left margin.</p>
79
<p>See also <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#rightMargin">rightMargin</a>(), and <a href="qtextblockformat.html#indent">indent</a>().</p>
80
<h3 class="fn"><a name="nonBreakableLines"></a>bool QTextBlockFormat::nonBreakableLines () const</h3>
81
<p>Returns true if the lines in the paragraph are non-breakable; otherwise returns false.</p>
82
<p>See also <a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a>().</p>
83
<h3 class="fn"><a name="rightMargin"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextBlockFormat::rightMargin () const</h3>
84
<p>Returns the paragraph's right margin.</p>
85
<p>See also <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>() and <a href="qtextblockformat.html#leftMargin">leftMargin</a>().</p>
86
<h3 class="fn"><a name="setAlignment"></a>void QTextBlockFormat::setAlignment ( <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> <i>alignment</i> )</h3>
87
<p>Sets the paragraph's <i>alignment</i>.</p>
88
<p>See also <a href="qtextblockformat.html#alignment">alignment</a>().</p>
89
<h3 class="fn"><a name="setBottomMargin"></a>void QTextBlockFormat::setBottomMargin ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>margin</i> )</h3>
90
<p>Sets the paragraph's bottom <i>margin</i>.</p>
91
<p>See also <a href="qtextblockformat.html#bottomMargin">bottomMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), and <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>().</p>
92
<h3 class="fn"><a name="setIndent"></a>void QTextBlockFormat::setIndent ( int <i>indentation</i> )</h3>
93
<p>Sets the paragraph's <i>indentation</i>. Margins are set independently of indentation with <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>() and setTextIdent().</p>
94
<p>See also <a href="qtextblockformat.html#indent">indent</a>().</p>
95
<h3 class="fn"><a name="setLeftMargin"></a>void QTextBlockFormat::setLeftMargin ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>margin</i> )</h3>
96
<p>Sets the paragraph's left <i>margin</i>. Indentation can be applied separately with <a href="qtextblockformat.html#setIndent">setIndent</a>().</p>
97
<p>See also <a href="qtextblockformat.html#leftMargin">leftMargin</a>(), <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), and <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>
98
<h3 class="fn"><a name="setNonBreakableLines"></a>void QTextBlockFormat::setNonBreakableLines ( bool <i>b</i> )</h3>
99
<p>If <i>b</i> is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.</p>
100
<p>See also <a href="qtextblockformat.html#nonBreakableLines">nonBreakableLines</a>().</p>
101
<h3 class="fn"><a name="setRightMargin"></a>void QTextBlockFormat::setRightMargin ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>margin</i> )</h3>
102
<p>Sets the paragraph's right <i>margin</i>.</p>
103
<p>See also <a href="qtextblockformat.html#rightMargin">rightMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), and <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>
104
<h3 class="fn"><a name="setTextIndent"></a>void QTextBlockFormat::setTextIndent ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>indent</i> )</h3>
105
<p>Sets the <i>indent</i> for the first line in the block. This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.</p>
106
<p>See also <a href="qtextblockformat.html#textIndent">textIndent</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), and <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>
107
<h3 class="fn"><a name="setTopMargin"></a>void QTextBlockFormat::setTopMargin ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>margin</i> )</h3>
108
<p>Sets the paragraph's top <i>margin</i>.</p>
109
<p>See also <a href="qtextblockformat.html#topMargin">topMargin</a>(), <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), and <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>().</p>
110
<h3 class="fn"><a name="textIndent"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextBlockFormat::textIndent () const</h3>
111
<p>Returns the paragraph's text indent.</p>
112
<p>See also <a href="qtextblockformat.html#setTextIndent">setTextIndent</a>().</p>
113
<h3 class="fn"><a name="topMargin"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextBlockFormat::topMargin () const</h3>
114
<p>Returns the paragraph's top margin.</p>
115
<p>See also <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>() and <a href="qtextblockformat.html#bottomMargin">bottomMargin</a>().</p>
116
<p /><address><hr /><div align="center">
117
<table width="100%" cellspacing="0" border="0"><tr class="address">
118
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
119
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
120
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
121
</tr></table></div></address></body>