File: qtextline.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (76 lines) | stat: -rw-r--r-- 12,255 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTextLine Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextLine Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextLine class represents a line of text inside a <a href="qtextlayout.html">QTextLayout</a>. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtextline.html#CursorPosition-enum">CursorPosition</a></b> { CursorBetweenCharacters, CursorOnCharacter }</li><li><div class="fn" />enum <b><a href="qtextline.html#Edge-enum">Edge</a></b> { Leading, Trailing }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextline.html#QTextLine">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextline.html#QTextLine-2">__init__</a></b> (<i>self</i>, QTextLine)</li><li><div class="fn" />float <b><a href="qtextline.html#ascent">ascent</a></b> (<i>self</i>)</li><li><div class="fn" />(float, int&#160;<i>cursorPos</i>) <b><a href="qtextline.html#cursorToX">cursorToX</a></b> (<i>self</i>, int&#160;<i>cursorPos</i>, Edge&#160;<i>edge</i>&#160;=&#160;QTextLine.Leading)</li><li><div class="fn" />float <b><a href="qtextline.html#descent">descent</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextline.html#draw">draw</a></b> (<i>self</i>, QPainter&#160;<i>p</i>, QPointF&#160;<i>point</i>, QTextLayout.FormatRange&#160;<i>selection</i>&#160;=&#160;None)</li><li><div class="fn" />float <b><a href="qtextline.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextline.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextline.html#lineNumber">lineNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qtextline.html#naturalTextRect">naturalTextRect</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextline.html#naturalTextWidth">naturalTextWidth</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qtextline.html#rect">rect</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextline.html#setLineWidth">setLineWidth</a></b> (<i>self</i>, float&#160;<i>width</i>)</li><li><div class="fn" /><b><a href="qtextline.html#setNumColumns">setNumColumns</a></b> (<i>self</i>, int&#160;<i>columns</i>)</li><li><div class="fn" /><b><a href="qtextline.html#setPosition">setPosition</a></b> (<i>self</i>, QPointF&#160;<i>pos</i>)</li><li><div class="fn" />int <b><a href="qtextline.html#textLength">textLength</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextline.html#textStart">textStart</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextline.html#width">width</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextline.html#x">x</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextline.html#xToCursor">xToCursor</a></b> (<i>self</i>, float&#160;<i>x</i>, CursorPosition&#160;=&#160;QTextLine.CursorBetweenCharacters)</li><li><div class="fn" />float <b><a href="qtextline.html#y">y</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextLine class represents a line of text inside a <a href="qtextlayout.html">QTextLayout</a>.</p>
<p>A text line is usually created by <a href="qtextlayout.html#createLine">QTextLayout.createLine</a>().</p>
<p>After being created, the line can be filled using the <a href="qtextline.html#setLineWidth">setLineWidth</a>() or <a href="qtextline.html#setNumColumns">setNumColumns</a>() functions. 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>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="CursorPosition-enum" />QTextLine.CursorPosition</h3><table border="1" cellpadding="2" cellspacing="1" width="40%">
<tr>
<th width="60%">Constant</th>
<th width="40%">Value</th>
</tr>
<tr>
<td valign="top"><tt>QTextLine.CursorBetweenCharacters</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextLine.CursorOnCharacter</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
</tr>
</table>
<br />
<br />
<h3 class="fn"><a name="Edge-enum" />QTextLine.Edge</h3><table border="1" cellpadding="2" cellspacing="1" width="40%">
<tr>
<th width="60%">Constant</th>
<th width="40%">Value</th>
</tr>
<tr>
<td valign="top"><tt>QTextLine.Leading</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
</tr>
<tr>
<td valign="top"><tt>QTextLine.Trailing</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextLine" />QTextLine.__init__ (<i>self</i>)</h3><p>Creates an invalid line.</p>
<h3 class="fn"><a name="QTextLine-2" />QTextLine.__init__ (<i>self</i>, <a href="qtextline.html">QTextLine</a>)</h3><h3 class="fn"><a name="ascent" />float QTextLine.ascent (<i>self</i>)</h3><p>Returns the line's ascent.</p>
<p>See also <a href="qtextline.html#descent">descent</a>() and <a href="qtextline.html#height">height</a>().</p>
<h3 class="fn"><a name="cursorToX" />(float, int&#160;<i>cursorPos</i>) QTextLine.cursorToX (<i>self</i>, int&#160;<i>cursorPos</i>, <a href="qtextline.html#Edge-enum">Edge</a>&#160;<i>edge</i>&#160;=&#160;QTextLine.Leading)</h3><p>Converts the cursor position <i>cursorPos</i> to the corresponding x position inside the line, taking account of the <i>edge</i>.</p>
<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>
<p>See also <a href="qtextline.html#xToCursor">xToCursor</a>().</p>
<h3 class="fn"><a name="descent" />float QTextLine.descent (<i>self</i>)</h3><p>Returns the line's descent.</p>
<p>See also <a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#height">height</a>().</p>
<h3 class="fn"><a name="draw" />QTextLine.draw (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>p</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, <a href="qtextlayout-formatrange.html">QTextLayout.FormatRange</a>&#160;<i>selection</i>&#160;=&#160;None)</h3><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>
<h3 class="fn"><a name="height" />float QTextLine.height (<i>self</i>)</h3><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>
<p>See also <a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#descent">descent</a>().</p>
<h3 class="fn"><a name="isValid" />bool QTextLine.isValid (<i>self</i>)</h3><p>Returns true if this text line is valid; otherwise returns false.</p>
<h3 class="fn"><a name="lineNumber" />int QTextLine.lineNumber (<i>self</i>)</h3><p>Returns the position of the line in the text engine.</p>
<h3 class="fn"><a name="naturalTextRect" /><a href="qrectf.html">QRectF</a> QTextLine.naturalTextRect (<i>self</i>)</h3><p>Returns the rectangle covered by the line.</p>
<h3 class="fn"><a name="naturalTextWidth" />float QTextLine.naturalTextWidth (<i>self</i>)</h3><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>
<h3 class="fn"><a name="rect" /><a href="qrectf.html">QRectF</a> QTextLine.rect (<i>self</i>)</h3><p>Returns the line's bounding rectangle.</p>
<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>
<h3 class="fn"><a name="setLineWidth" />QTextLine.setLineWidth (<i>self</i>, float&#160;<i>width</i>)</h3><p>Lays out the line with the given <i>width</i>. The line is filled from its starting position with as many characters as will fit into the line.</p>
<h3 class="fn"><a name="setNumColumns" />QTextLine.setNumColumns (<i>self</i>, int&#160;<i>columns</i>)</h3><p>Lays out the line. The line is filled from its starting position with as many characters as are specified by <i>numColumns</i>.</p>
<h3 class="fn"><a name="setPosition" />QTextLine.setPosition (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>pos</i>)</h3><p>Moves the line to position <i>pos</i>.</p>
<h3 class="fn"><a name="textLength" />int QTextLine.textLength (<i>self</i>)</h3><p>Returns the length of the text in the line.</p>
<p>See also <a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>().</p>
<h3 class="fn"><a name="textStart" />int QTextLine.textStart (<i>self</i>)</h3><p>Returns the start of the line from the beginning of the string passed to the <a href="qtextlayout.html">QTextLayout</a>.</p>
<h3 class="fn"><a name="width" />float QTextLine.width (<i>self</i>)</h3><p>Returns the line's width as specified by the layout() function.</p>
<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>
<h3 class="fn"><a name="x" />float QTextLine.x (<i>self</i>)</h3><p>Returns the line's x position.</p>
<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>
<h3 class="fn"><a name="xToCursor" />int QTextLine.xToCursor (<i>self</i>, float&#160;<i>x</i>, <a href="qtextline.html#CursorPosition-enum">CursorPosition</a>&#160;=&#160;QTextLine.CursorBetweenCharacters)</h3><p>Converts the x-coordinate <i>x</i>, to the nearest matching cursor position, depending on the cursor position type, <i>cpos</i>.</p>
<p>See also <a href="qtextline.html#cursorToX">cursorToX</a>().</p>
<h3 class="fn"><a name="y" />float QTextLine.y (<i>self</i>)</h3><p>Returns the line's y position.</p>
<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>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>