~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qtextline.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
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/qtextlayout.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QTextLine 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>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
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">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <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">QTextLine Class Reference</h1>
 
21
<p>The QTextLine class represents a line of text inside a <a href="qtextlayout.html">QTextLayout</a>. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QTextLine&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<ul>
 
24
<li><a href="qtextline-members.html">List of all members, including inherited members</a></li>
 
25
</ul>
 
26
<a name="public-types"></a>
 
27
<h3>Public Types</h3>
 
28
<ul>
 
29
<li><div class="fn"/>enum <b><a href="qtextline.html#CursorPosition-enum">CursorPosition</a></b> { CursorBetweenCharacters, CursorOnCharacter }</li>
 
30
<li><div class="fn"/>enum <b><a href="qtextline.html#Edge-enum">Edge</a></b> { Leading, Trailing }</li>
 
31
</ul>
 
32
<a name="public-functions"></a>
 
33
<h3>Public Functions</h3>
 
34
<ul>
 
35
<li><div class="fn"/><b><a href="qtextline.html#QTextLine">QTextLine</a></b> ()</li>
 
36
<li><div class="fn"/>qreal <b><a href="qtextline.html#ascent">ascent</a></b> () const</li>
 
37
<li><div class="fn"/>qreal <b><a href="qtextline.html#cursorToX">cursorToX</a></b> ( int * <i>cursorPos</i>, Edge <i>edge</i> = Leading ) const</li>
 
38
<li><div class="fn"/>qreal <b><a href="qtextline.html#cursorToX-2">cursorToX</a></b> ( int <i>cursorPos</i>, Edge <i>edge</i> = Leading ) const</li>
 
39
<li><div class="fn"/>qreal <b><a href="qtextline.html#descent">descent</a></b> () const</li>
 
40
<li><div class="fn"/>void <b><a href="qtextline.html#draw">draw</a></b> ( QPainter * <i>painter</i>, const QPointF &amp; <i>position</i>, const QTextLayout::FormatRange * <i>selection</i> = 0 ) const</li>
 
41
<li><div class="fn"/>qreal <b><a href="qtextline.html#height">height</a></b> () const</li>
 
42
<li><div class="fn"/>bool <b><a href="qtextline.html#isValid">isValid</a></b> () const</li>
 
43
<li><div class="fn"/>int <b><a href="qtextline.html#lineNumber">lineNumber</a></b> () const</li>
 
44
<li><div class="fn"/>QRectF <b><a href="qtextline.html#naturalTextRect">naturalTextRect</a></b> () const</li>
 
45
<li><div class="fn"/>qreal <b><a href="qtextline.html#naturalTextWidth">naturalTextWidth</a></b> () const</li>
 
46
<li><div class="fn"/>QRectF <b><a href="qtextline.html#rect">rect</a></b> () const</li>
 
47
<li><div class="fn"/>void <b><a href="qtextline.html#setLineWidth">setLineWidth</a></b> ( qreal <i>width</i> )</li>
 
48
<li><div class="fn"/>void <b><a href="qtextline.html#setNumColumns">setNumColumns</a></b> ( int <i>numColumns</i> )</li>
 
49
<li><div class="fn"/>void <b><a href="qtextline.html#setPosition">setPosition</a></b> ( const QPointF &amp; <i>pos</i> )</li>
 
50
<li><div class="fn"/>int <b><a href="qtextline.html#textLength">textLength</a></b> () const</li>
 
51
<li><div class="fn"/>int <b><a href="qtextline.html#textStart">textStart</a></b> () const</li>
 
52
<li><div class="fn"/>qreal <b><a href="qtextline.html#width">width</a></b> () const</li>
 
53
<li><div class="fn"/>qreal <b><a href="qtextline.html#x">x</a></b> () const</li>
 
54
<li><div class="fn"/>int <b><a href="qtextline.html#xToCursor">xToCursor</a></b> ( qreal <i>x</i>, CursorPosition <i>cpos</i> = CursorBetweenCharacters ) const</li>
 
55
<li><div class="fn"/>qreal <b><a href="qtextline.html#y">y</a></b> () const</li>
 
56
</ul>
 
57
<a name="details"></a>
 
58
<hr />
 
59
<h2>Detailed Description</h2>
 
60
<p>The QTextLine class represents a line of text inside a <a href="qtextlayout.html">QTextLayout</a>.</p>
 
61
<p>A text line is usually created by <a href="qtextlayout.html#createLine">QTextLayout::createLine</a>().</p>
 
62
<p>After being created, the line can be filled using the layout() function. A line has a number of attributes including the rectangle it occupies, <a href="qtextline.html#rect">rect</a>(), its coordinates, <a href="qtextline.html#x">x</a>() and <a href="qtextline.html#y">y</a>(), its <a href="qtextline.html#textLength">textLength</a>(), <a href="qtextline.html#width">width</a>() and <a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>(), and its <a href="qtextline.html#ascent">ascent</a>() and decent() relative to the text. The position of the cursor in terms of the line is available from <a href="qtextline.html#cursorToX">cursorToX</a>() and its inverse from <a href="qtextline.html#xToCursor">xToCursor</a>(). A line can be moved with <a href="qtextline.html#setPosition">setPosition</a>().</p>
 
63
<hr />
 
64
<h2>Member Type Documentation</h2>
 
65
<h3 class="fn"><a name="CursorPosition-enum"></a>enum QTextLine::CursorPosition</h3>
 
66
<table border="1" cellpadding="2" cellspacing="1" width="40%">
 
67
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
 
68
<tr><td valign="top"><tt>QTextLine::CursorBetweenCharacters</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
 
69
<tr><td valign="top"><tt>QTextLine::CursorOnCharacter</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
 
70
</table>
 
71
<h3 class="fn"><a name="Edge-enum"></a>enum QTextLine::Edge</h3>
 
72
<table border="1" cellpadding="2" cellspacing="1" width="40%">
 
73
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
 
74
<tr><td valign="top"><tt>QTextLine::Leading</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
 
75
<tr><td valign="top"><tt>QTextLine::Trailing</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
 
76
</table>
 
77
<hr />
 
78
<h2>Member Function Documentation</h2>
 
79
<h3 class="fn"><a name="QTextLine"></a>QTextLine::QTextLine ()</h3>
 
80
<p>Creates an invalid line.</p>
 
81
<h3 class="fn"><a name="ascent"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::ascent () const</h3>
 
82
<p>Returns the line's ascent.</p>
 
83
<p>See also <a href="qtextline.html#descent">descent</a>() and <a href="qtextline.html#height">height</a>().</p>
 
84
<h3 class="fn"><a name="cursorToX"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::cursorToX ( int * <i>cursorPos</i>, <a href="qtextline.html#Edge-enum">Edge</a> <i>edge</i> = Leading ) const</h3>
 
85
<p>Converts the cursor position <i>cursorPos</i> to the corresponding x position inside the line, taking account of the <i>edge</i>.</p>
 
86
<p>If <i>cursorPos</i> is not a valid cursor position, the nearest valid cursor position will be used instead, and cpos will be modified to point to this valid cursor position.</p>
 
87
<p>See also <a href="qtextline.html#xToCursor">xToCursor</a>().</p>
 
88
<h3 class="fn"><a name="cursorToX-2"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::cursorToX ( int <i>cursorPos</i>, <a href="qtextline.html#Edge-enum">Edge</a> <i>edge</i> = Leading ) const</h3>
 
89
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
90
<h3 class="fn"><a name="descent"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::descent () const</h3>
 
91
<p>Returns the line's descent.</p>
 
92
<p>See also <a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#height">height</a>().</p>
 
93
<h3 class="fn"><a name="draw"></a>void QTextLine::draw ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qpointf.html">QPointF</a> &amp; <i>position</i>, const <a href="qtextlayout-formatrange.html">QTextLayout::FormatRange</a> * <i>selection</i> = 0 ) const</h3>
 
94
<p>Draws a line on the given <i>painter</i> at the specified <i>position</i>. The <i>selection</i> is reserved for internal use.</p>
 
95
<h3 class="fn"><a name="height"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::height () const</h3>
 
96
<p>Returns the line's height. This is equal to <a href="qtextline.html#ascent">ascent</a>() + <a href="qtextline.html#descent">descent</a>() + 1.</p>
 
97
<p>See also <a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#descent">descent</a>().</p>
 
98
<h3 class="fn"><a name="isValid"></a>bool QTextLine::isValid () const</h3>
 
99
<p>Returns true if this text line is valid; otherwise returns false.</p>
 
100
<h3 class="fn"><a name="lineNumber"></a>int QTextLine::lineNumber () const</h3>
 
101
<p>Returns the position of the line in the text engine.</p>
 
102
<h3 class="fn"><a name="naturalTextRect"></a><a href="qrectf.html">QRectF</a> QTextLine::naturalTextRect () const</h3>
 
103
<p>Returns the rectangle covered by the line.</p>
 
104
<h3 class="fn"><a name="naturalTextWidth"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::naturalTextWidth () const</h3>
 
105
<p>Returns the width of the line that is occupied by text. This is always &lt;= to <a href="qtextline.html#width">width</a>(), and is the minimum width that could be used by layout() without changing the line break position.</p>
 
106
<h3 class="fn"><a name="rect"></a><a href="qrectf.html">QRectF</a> QTextLine::rect () const</h3>
 
107
<p>Returns the line's bounding rectangle.</p>
 
108
<p>See also <a href="qtextline.html#x">x</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
 
109
<h3 class="fn"><a name="setLineWidth"></a>void QTextLine::setLineWidth ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>width</i> )</h3>
 
110
<p>Lays out the line with the given <i>width</i>. The line is filled from it's starting position with as many characters as will fit into the line.</p>
 
111
<h3 class="fn"><a name="setNumColumns"></a>void QTextLine::setNumColumns ( int <i>numColumns</i> )</h3>
 
112
<p>Lays out the line. The line is filled from it's starting position with as many characters as are specified by <i>numColumns</i>.</p>
 
113
<h3 class="fn"><a name="setPosition"></a>void QTextLine::setPosition ( const <a href="qpointf.html">QPointF</a> &amp; <i>pos</i> )</h3>
 
114
<p>Moves the line to position <i>pos</i>.</p>
 
115
<h3 class="fn"><a name="textLength"></a>int QTextLine::textLength () const</h3>
 
116
<p>Returns the length of the text in the line.</p>
 
117
<p>See also <a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>().</p>
 
118
<h3 class="fn"><a name="textStart"></a>int QTextLine::textStart () const</h3>
 
119
<p>Returns the start of the line from the beginning of the string passed to the <a href="qtextlayout.html">QTextLayout</a>.</p>
 
120
<h3 class="fn"><a name="width"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::width () const</h3>
 
121
<p>Returns the line's width as specified by the layout() function.</p>
 
122
<p>See also <a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>(), <a href="qtextline.html#x">x</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#rect">rect</a>().</p>
 
123
<h3 class="fn"><a name="x"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::x () const</h3>
 
124
<p>Returns the line's x position.</p>
 
125
<p>See also <a href="qtextline.html#rect">rect</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
 
126
<h3 class="fn"><a name="xToCursor"></a>int QTextLine::xToCursor ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtextline.html#CursorPosition-enum">CursorPosition</a> <i>cpos</i> = CursorBetweenCharacters ) const</h3>
 
127
<p>Converts the x-coordinate <i>x</i>, to the nearest matching cursor position, depending on the cursor position type, <i>cpos</i>.</p>
 
128
<p>See also <a href="qtextline.html#cursorToX">cursorToX</a>().</p>
 
129
<h3 class="fn"><a name="y"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLine::y () const</h3>
 
130
<p>Returns the line's y position.</p>
 
131
<p>See also <a href="qtextline.html#x">x</a>(), <a href="qtextline.html#rect">rect</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
 
132
<p /><address><hr /><div align="center">
 
133
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
134
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
135
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
136
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
137
</tr></table></div></address></body>
 
138
</html>