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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
|
<?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>QTextLayout 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">  </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="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextLayout Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextLayout class is used to lay out and render text.
<a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtextlayout.html#CursorMode-enum">CursorMode</a></b> { SkipCharacters, SkipWords }</li><li><div class="fn" />class <b><a href="qtextlayout-formatrange.html">FormatRange</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextlayout.html#QTextLayout">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#QTextLayout-2">__init__</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#QTextLayout-3">__init__</a></b> (<i>self</i>, QString <i>text</i>, QFont <i>font</i>, QPaintDevice <i>paintDevice</i> = None)</li><li><div class="fn" /><b><a href="qtextlayout.html#QTextLayout-4">__init__</a></b> (<i>self</i>, QTextBlock <i>b</i>)</li><li><div class="fn" />unknown-type <b><a href="qtextlayout.html#additionalFormats">additionalFormats</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#beginLayout">beginLayout</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qtextlayout.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextlayout.html#cacheEnabled">cacheEnabled</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#clearAdditionalFormats">clearAdditionalFormats</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#clearLayout">clearLayout</a></b> (<i>self</i>)</li><li><div class="fn" />QTextLine <b><a href="qtextlayout.html#createLine">createLine</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.CursorMoveStyle <b><a href="qtextlayout.html#cursorMoveStyle">cursorMoveStyle</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#draw">draw</a></b> (<i>self</i>, QPainter <i>p</i>, QPointF <i>pos</i>, unknown-type <i>selections</i> = QVector<QTextLayout.FormatRange>(), QRectF <i>clip</i> = QRectF())</li><li><div class="fn" /><b><a href="qtextlayout.html#drawCursor">drawCursor</a></b> (<i>self</i>, QPainter <i>p</i>, QPointF <i>pos</i>, int <i>cursorPosition</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#drawCursor-2">drawCursor</a></b> (<i>self</i>, QPainter <i>p</i>, QPointF <i>pos</i>, int <i>cursorPosition</i>, int <i>width</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#endLayout">endLayout</a></b> (<i>self</i>)</li><li><div class="fn" />QFont <b><a href="qtextlayout.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qtextlayout.html#glyphRuns">glyphRuns</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextlayout.html#isValidCursorPosition">isValidCursorPosition</a></b> (<i>self</i>, int <i>pos</i>)</li><li><div class="fn" />int <b><a href="qtextlayout.html#leftCursorPosition">leftCursorPosition</a></b> (<i>self</i>, int <i>oldPos</i>)</li><li><div class="fn" />QTextLine <b><a href="qtextlayout.html#lineAt">lineAt</a></b> (<i>self</i>, int <i>i</i>)</li><li><div class="fn" />int <b><a href="qtextlayout.html#lineCount">lineCount</a></b> (<i>self</i>)</li><li><div class="fn" />QTextLine <b><a href="qtextlayout.html#lineForTextPosition">lineForTextPosition</a></b> (<i>self</i>, int <i>pos</i>)</li><li><div class="fn" />float <b><a href="qtextlayout.html#maximumWidth">maximumWidth</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextlayout.html#minimumWidth">minimumWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextlayout.html#nextCursorPosition">nextCursorPosition</a></b> (<i>self</i>, int <i>oldPos</i>, CursorMode <i>mode</i> = QTextLayout.SkipCharacters)</li><li><div class="fn" />QPointF <b><a href="qtextlayout.html#position">position</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextlayout.html#preeditAreaPosition">preeditAreaPosition</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextlayout.html#preeditAreaText">preeditAreaText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextlayout.html#previousCursorPosition">previousCursorPosition</a></b> (<i>self</i>, int <i>oldPos</i>, CursorMode <i>mode</i> = QTextLayout.SkipCharacters)</li><li><div class="fn" />int <b><a href="qtextlayout.html#rightCursorPosition">rightCursorPosition</a></b> (<i>self</i>, int <i>oldPos</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setAdditionalFormats">setAdditionalFormats</a></b> (<i>self</i>, unknown-type <i>overrides</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setCacheEnabled">setCacheEnabled</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setCursorMoveStyle">setCursorMoveStyle</a></b> (<i>self</i>, Qt.CursorMoveStyle <i>style</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setFont">setFont</a></b> (<i>self</i>, QFont <i>f</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setPosition">setPosition</a></b> (<i>self</i>, QPointF <i>p</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setPreeditArea">setPreeditArea</a></b> (<i>self</i>, int <i>position</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setText">setText</a></b> (<i>self</i>, QString <i>string</i>)</li><li><div class="fn" /><b><a href="qtextlayout.html#setTextOption">setTextOption</a></b> (<i>self</i>, QTextOption <i>option</i>)</li><li><div class="fn" />QString <b><a href="qtextlayout.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />QTextOption <b><a href="qtextlayout.html#textOption">textOption</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextLayout class is used to lay out and render text.</p>
<p>It offers many features expected from a modern text layout
engine, including Unicode compliant rendering, line breaking and
handling of cursor positioning. It can also produce and render
device independent layout, something that is important for WYSIWYG
applications.</p>
<p>The class has a rather low level API and unless you intend to
implement your own text rendering for some specialized widget, you
probably won't need to use it directly.</p>
<p>QTextLayout can be used with both plain and rich text.</p>
<p>QTextLayout can be used to create a sequence of <a href="qtextline.html">QTextLine</a> instances with given widths and can
position them independently on the screen. Once the layout is done,
these lines can be drawn on a paint device.</p>
<p>The text to be laid out can be provided in the constructor or
set with <a href="qtextlayout.html#setText">setText</a>().</p>
<p>The layout can be seen as a sequence of <a href="qtextline.html">QTextLine</a> objects; use <a href="qtextlayout.html#createLine">createLine</a>() to create a <a href="qtextline.html">QTextLine</a> instance, and <a href="qtextlayout.html#lineAt">lineAt</a>() or <a href="qtextlayout.html#lineForTextPosition">lineForTextPosition</a>() to
retrieve created lines.</p>
<p>Here is a code snippet that demonstrates the layout phase:</p>
<pre class="cpp">
<span class="type">int</span> leading <span class="operator">=</span> fontMetrics<span class="operator">.</span>leading();
<span class="type"><a href="qtcore.html#qreal-typedef">qreal</a></span> height <span class="operator">=</span> <span class="number">0</span>;
textLayout<span class="operator">.</span><a href="qtextlayout.html#beginLayout">beginLayout</a>();
<span class="keyword">while</span> (<span class="number">1</span>) {
<span class="type"><a href="qtextline.html">QTextLine</a></span> line <span class="operator">=</span> textLayout<span class="operator">.</span>createLine();
<span class="keyword">if</span> (<span class="operator">!</span>line<span class="operator">.</span>isValid())
<span class="keyword">break</span>;
line<span class="operator">.</span>setLineWidth(lineWidth);
height <span class="operator">+</span><span class="operator">=</span> leading;
line<span class="operator">.</span>setPosition(<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">0</span><span class="operator">,</span> height));
height <span class="operator">+</span><span class="operator">=</span> line<span class="operator">.</span>height();
}
textLayout<span class="operator">.</span><a href="qtextlayout.html#endLayout">endLayout</a>();
</pre>
<p>The text can then be rendered by calling the layout's <a href="qtextlayout.html#draw">draw</a>() function:</p>
<pre class="cpp">
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
textLayout<span class="operator">.</span><a href="qtextlayout.html#draw">draw</a>(<span class="operator">&</span>painter<span class="operator">,</span> <span class="type"><a href="qpoint.html">QPoint</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>));
</pre>
<p>For a given position in the text you can find a valid cursor
position with <a href="qtextlayout.html#isValidCursorPosition">isValidCursorPosition</a>(),
<a href="qtextlayout.html#nextCursorPosition">nextCursorPosition</a>(), and
<a href="qtextlayout.html#previousCursorPosition">previousCursorPosition</a>().</p>
<p>The QTextLayout itself can be positioned with <a href="qtextlayout.html#setPosition">setPosition</a>(); it has a <a href="qtextlayout.html#boundingRect">boundingRect</a>(), and a <a href="qtextlayout.html#minimumWidth">minimumWidth</a>() and a <a href="qtextlayout.html#maximumWidth">maximumWidth</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="CursorMode-enum" />QTextLayout.CursorMode</h3><table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QTextLayout.SkipCharacters</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QTextLayout.SkipWords</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextLayout" />QTextLayout.__init__ (<i>self</i>)</h3><p>Constructs an empty text layout.</p>
<p><b>See also</b> <a href="qtextlayout.html#setText">setText</a>().</p>
<h3 class="fn"><a name="QTextLayout-2" />QTextLayout.__init__ (<i>self</i>, QString <i>text</i>)</h3><p>Constructs a text layout to lay out the given <i>text</i>.</p>
<h3 class="fn"><a name="QTextLayout-3" />QTextLayout.__init__ (<i>self</i>, QString <i>text</i>, <a href="qfont.html">QFont</a> <i>font</i>, <a href="qpaintdevice.html">QPaintDevice</a> <i>paintDevice</i> = None)</h3><p>Constructs a text layout to lay out the given <i>text</i> with
the specified <i>font</i>.</p>
<p>All the metric and layout calculations will be done in terms of
the paint device, <i>paintdevice</i>. If <i>paintdevice</i> is 0
the calculations will be done in screen metrics.</p>
<h3 class="fn"><a name="QTextLayout-4" />QTextLayout.__init__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a> <i>b</i>)</h3><h3 class="fn"><a name="additionalFormats" />unknown-type QTextLayout.additionalFormats (<i>self</i>)</h3><p>Returns the list of additional formats supported by the text
layout.</p>
<p><b>See also</b> <a href="qtextlayout.html#setAdditionalFormats">setAdditionalFormats</a>()
and <a href="qtextlayout.html#clearAdditionalFormats">clearAdditionalFormats</a>().</p>
<h3 class="fn"><a name="beginLayout" />QTextLayout.beginLayout (<i>self</i>)</h3><p>Begins the layout process.</p>
<p><b>See also</b> <a href="qtextlayout.html#endLayout">endLayout</a>().</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QTextLayout.boundingRect (<i>self</i>)</h3><p>The smallest rectangle that contains all the lines in the
layout.</p>
<h3 class="fn"><a name="cacheEnabled" />bool QTextLayout.cacheEnabled (<i>self</i>)</h3><p>Returns true if the complete layout information is cached;
otherwise returns false.</p>
<p><b>See also</b> <a href="qtextlayout.html#setCacheEnabled">setCacheEnabled</a>().</p>
<h3 class="fn"><a name="clearAdditionalFormats" />QTextLayout.clearAdditionalFormats (<i>self</i>)</h3><p>Clears the list of additional formats supported by the text
layout.</p>
<p><b>See also</b> <a href="qtextlayout.html#additionalFormats">additionalFormats</a>() and
<a href="qtextlayout.html#setAdditionalFormats">setAdditionalFormats</a>().</p>
<h3 class="fn"><a name="clearLayout" />QTextLayout.clearLayout (<i>self</i>)</h3><p>Clears the line information in the layout. After having called
this function, <a href="qtextlayout.html#lineCount">lineCount</a>()
returns 0.</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="createLine" /><a href="qtextline.html">QTextLine</a> QTextLayout.createLine (<i>self</i>)</h3><p>Returns a new text line to be laid out if there is text to be
inserted into the layout; otherwise returns an invalid text
line.</p>
<p>The text layout creates a new line object that starts after the
last line in the layout, or at the beginning if the layout is
empty. The layout maintains an internal cursor, and each line is
filled with text from the cursor position onwards when the <a href="qtextline.html#setLineWidth">QTextLine.setLineWidth</a>()
function is called.</p>
<p>Once <a href="qtextline.html#setLineWidth">QTextLine.setLineWidth</a>() is
called, a new line can be created and filled with text. Repeating
this process will lay out the whole block of text contained in the
<a href="qtextlayout.html">QTextLayout</a>. If there is no text
left to be inserted into the layout, the <a href="qtextline.html">QTextLine</a> returned will not be valid
(isValid() will return false).</p>
<h3 class="fn"><a name="cursorMoveStyle" /><a href="qt.html#CursorMoveStyle-enum">Qt.CursorMoveStyle</a> QTextLayout.cursorMoveStyle (<i>self</i>)</h3><p>The cursor movement style of this <a href="qtextlayout.html">QTextLayout</a>. The default is <a href="qt.html#CursorMoveStyle-enum">Qt.LogicalMoveStyle</a>.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qtextlayout.html#setCursorMoveStyle">setCursorMoveStyle</a>().</p>
<h3 class="fn"><a name="draw" />QTextLayout.draw (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>p</i>, <a href="qpointf.html">QPointF</a> <i>pos</i>, unknown-type <i>selections</i> = QVector<QTextLayout.FormatRange>(), <a href="qrectf.html">QRectF</a> <i>clip</i> = QRectF())</h3><p>Draws the whole layout on the painter <i>p</i> at the position
specified by <i>pos</i>. The rendered layout includes the given
<i>selections</i> and is clipped within the rectangle specified by
<i>clip</i>.</p>
<h3 class="fn"><a name="drawCursor" />QTextLayout.drawCursor (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>p</i>, <a href="qpointf.html">QPointF</a> <i>pos</i>, int <i>cursorPosition</i>)</h3><p>Draws a text cursor with the current pen and the specified
<i>width</i> at the given <i>position</i> using the <i>painter</i>
specified. The corresponding position within the text is specified
by <i>cursorPosition</i>.</p>
<h3 class="fn"><a name="drawCursor-2" />QTextLayout.drawCursor (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>p</i>, <a href="qpointf.html">QPointF</a> <i>pos</i>, int <i>cursorPosition</i>, int <i>width</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a text cursor with the current pen at the given
<i>position</i> using the <i>painter</i> specified. The
corresponding position within the text is specified by
<i>cursorPosition</i>.</p>
<h3 class="fn"><a name="endLayout" />QTextLayout.endLayout (<i>self</i>)</h3><p>Ends the layout process.</p>
<p><b>See also</b> <a href="qtextlayout.html#beginLayout">beginLayout</a>().</p>
<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QTextLayout.font (<i>self</i>)</h3><p>Returns the current font that is used for the layout, or a
default font if none is set.</p>
<p><b>See also</b> <a href="qtextlayout.html#setFont">setFont</a>().</p>
<h3 class="fn"><a name="glyphRuns" />unknown-type QTextLayout.glyphRuns (<i>self</i>)</h3><p>Returns the glyph indexes and positions for all glyphs in this
<a href="qtextlayout.html">QTextLayout</a>. This is an expensive
function, and should not be called in a time sensitive context.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qtextlayout.html#draw">draw</a>() and
<a href="qpainter.html#drawGlyphRun">QPainter.drawGlyphRun</a>().</p>
<h3 class="fn"><a name="isValidCursorPosition" />bool QTextLayout.isValidCursorPosition (<i>self</i>, int <i>pos</i>)</h3><p>/ Returns true if position <i>pos</i> is a valid cursor
position.</p>
<p>In a Unicode context some positions in the text are not valid
cursor positions, because the position is inside a Unicode
surrogate or a grapheme cluster.</p>
<p>A grapheme cluster is a sequence of two or more Unicode
characters that form one indivisible entity on the screen. For
example the latin character `Ä' can be represented in Unicode
by two characters, `A' (0x41), and the combining diaresis (0x308).
A text cursor can only validly be positioned before or after these
two characters, never between them since that wouldn't make sense.
In indic languages every syllable forms a grapheme cluster.</p>
<h3 class="fn"><a name="leftCursorPosition" />int QTextLayout.leftCursorPosition (<i>self</i>, int <i>oldPos</i>)</h3><p>Returns the cursor position to the left of <i>oldPos</i>, next
to it. The position is dependent on the visual position of
characters, after bi-directional reordering.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qtextlayout.html#rightCursorPosition">rightCursorPosition</a>()
and <a href="qtextlayout.html#previousCursorPosition">previousCursorPosition</a>().</p>
<h3 class="fn"><a name="lineAt" /><a href="qtextline.html">QTextLine</a> QTextLayout.lineAt (<i>self</i>, int <i>i</i>)</h3><p>Returns the <i>i</i>-th line of text in this text layout.</p>
<p><b>See also</b> <a href="qtextlayout.html#lineCount">lineCount</a>() and <a href="qtextlayout.html#lineForTextPosition">lineForTextPosition</a>().</p>
<h3 class="fn"><a name="lineCount" />int QTextLayout.lineCount (<i>self</i>)</h3><p>Returns the number of lines in this text layout.</p>
<p><b>See also</b> <a href="qtextlayout.html#lineAt">lineAt</a>().</p>
<h3 class="fn"><a name="lineForTextPosition" /><a href="qtextline.html">QTextLine</a> QTextLayout.lineForTextPosition (<i>self</i>, int <i>pos</i>)</h3><p>Returns the line that contains the cursor position specified by
<i>pos</i>.</p>
<p><b>See also</b> <a href="qtextlayout.html#isValidCursorPosition">isValidCursorPosition</a>()
and <a href="qtextlayout.html#lineAt">lineAt</a>().</p>
<h3 class="fn"><a name="maximumWidth" />float QTextLayout.maximumWidth (<i>self</i>)</h3><p>The maximum width the layout could expand to; this is
essentially the width of the entire text.</p>
<p><b>Warning:</b> This function only returns a valid value after
the layout has been done.</p>
<p><b>See also</b> <a href="qtextlayout.html#minimumWidth">minimumWidth</a>().</p>
<h3 class="fn"><a name="minimumWidth" />float QTextLayout.minimumWidth (<i>self</i>)</h3><p>The minimum width the layout needs. This is the width of the
layout's smallest non-breakable substring.</p>
<p><b>Warning:</b> This function only returns a valid value after
the layout has been done.</p>
<p><b>See also</b> <a href="qtextlayout.html#maximumWidth">maximumWidth</a>().</p>
<h3 class="fn"><a name="nextCursorPosition" />int QTextLayout.nextCursorPosition (<i>self</i>, int <i>oldPos</i>, <a href="qtextlayout.html#CursorMode-enum">CursorMode</a> <i>mode</i> = QTextLayout.SkipCharacters)</h3><p>Returns the next valid cursor position after <i>oldPos</i> that
respects the given cursor <i>mode</i>. Returns value of
<i>oldPos</i>, if <i>oldPos</i> is not a valid cursor position.</p>
<p><b>See also</b> <a href="qtextlayout.html#isValidCursorPosition">isValidCursorPosition</a>()
and <a href="qtextlayout.html#previousCursorPosition">previousCursorPosition</a>().</p>
<h3 class="fn"><a name="position" /><a href="qpointf.html">QPointF</a> QTextLayout.position (<i>self</i>)</h3><p>The global position of the layout. This is independent of the
bounding rectangle and of the layout process.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtextlayout.html#setPosition">setPosition</a>().</p>
<h3 class="fn"><a name="preeditAreaPosition" />int QTextLayout.preeditAreaPosition (<i>self</i>)</h3><p>Returns the position of the area in the text layout that will be
processed before editing occurs.</p>
<p><b>See also</b> <a href="qtextlayout.html#preeditAreaText">preeditAreaText</a>().</p>
<h3 class="fn"><a name="preeditAreaText" />QString QTextLayout.preeditAreaText (<i>self</i>)</h3><p>Returns the text that is inserted in the layout before editing
occurs.</p>
<p><b>See also</b> <a href="qtextlayout.html#preeditAreaPosition">preeditAreaPosition</a>().</p>
<h3 class="fn"><a name="previousCursorPosition" />int QTextLayout.previousCursorPosition (<i>self</i>, int <i>oldPos</i>, <a href="qtextlayout.html#CursorMode-enum">CursorMode</a> <i>mode</i> = QTextLayout.SkipCharacters)</h3><p>Returns the first valid cursor position before <i>oldPos</i>
that respects the given cursor <i>mode</i>. Returns value of
<i>oldPos</i>, if <i>oldPos</i> is not a valid cursor position.</p>
<p><b>See also</b> <a href="qtextlayout.html#isValidCursorPosition">isValidCursorPosition</a>()
and <a href="qtextlayout.html#nextCursorPosition">nextCursorPosition</a>().</p>
<h3 class="fn"><a name="rightCursorPosition" />int QTextLayout.rightCursorPosition (<i>self</i>, int <i>oldPos</i>)</h3><p>Returns the cursor position to the right of <i>oldPos</i>, next
to it. The position is dependent on the visual position of
characters, after bi-directional reordering.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qtextlayout.html#leftCursorPosition">leftCursorPosition</a>() and
<a href="qtextlayout.html#nextCursorPosition">nextCursorPosition</a>().</p>
<h3 class="fn"><a name="setAdditionalFormats" />QTextLayout.setAdditionalFormats (<i>self</i>, unknown-type <i>overrides</i>)</h3><p>Sets the additional formats supported by the text layout to
<i>formatList</i>.</p>
<p><b>See also</b> <a href="qtextlayout.html#additionalFormats">additionalFormats</a>() and
<a href="qtextlayout.html#clearAdditionalFormats">clearAdditionalFormats</a>().</p>
<h3 class="fn"><a name="setCacheEnabled" />QTextLayout.setCacheEnabled (<i>self</i>, bool <i>enable</i>)</h3><p>Enables caching of the complete layout information if
<i>enable</i> is true; otherwise disables layout caching. Usually
<a href="qtextlayout.html">QTextLayout</a> throws most of the
layouting information away after a call to <a href="qtextlayout.html#endLayout">endLayout</a>() to reduce memory
consumption. If you however want to draw the laid out text directly
afterwards enabling caching might speed up drawing
significantly.</p>
<p><b>See also</b> <a href="qtextlayout.html#cacheEnabled">cacheEnabled</a>().</p>
<h3 class="fn"><a name="setCursorMoveStyle" />QTextLayout.setCursorMoveStyle (<i>self</i>, <a href="qt.html#CursorMoveStyle-enum">Qt.CursorMoveStyle</a> <i>style</i>)</h3><p>Set the cursor movement style. If the <a href="qtextlayout.html">QTextLayout</a> is backed by a document, you can
ignore this and use the option in <a href="qtextdocument.html">QTextDocument</a>, this option is for widgets
like <a href="qlineedit.html">QLineEdit</a> or custom widgets
without a <a href="qtextdocument.html">QTextDocument</a>. Default
value is <a href="qt.html#CursorMoveStyle-enum">Qt.LogicalMoveStyle</a>.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qtextlayout.html#cursorMoveStyle">cursorMoveStyle</a>().</p>
<h3 class="fn"><a name="setFont" />QTextLayout.setFont (<i>self</i>, <a href="qfont.html">QFont</a> <i>f</i>)</h3><p>Sets the layout's font to the given <i>font</i>. The layout is
invalidated and must be laid out again.</p>
<p><b>See also</b> <a href="qtextlayout.html#font">font</a>().</p>
<h3 class="fn"><a name="setPosition" />QTextLayout.setPosition (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>)</h3><p>Moves the text layout to point <i>p</i>.</p>
<p><b>See also</b> <a href="qtextlayout.html#position">position</a>().</p>
<h3 class="fn"><a name="setPreeditArea" />QTextLayout.setPreeditArea (<i>self</i>, int <i>position</i>, QString <i>text</i>)</h3><p>Sets the <i>position</i> and <i>text</i> of the area in the
layout that is processed before editing occurs.</p>
<p><b>See also</b> <a href="qtextlayout.html#preeditAreaPosition">preeditAreaPosition</a>()
and <a href="qtextlayout.html#preeditAreaText">preeditAreaText</a>().</p>
<h3 class="fn"><a name="setText" />QTextLayout.setText (<i>self</i>, QString <i>string</i>)</h3><p>Sets the layout's text to the given <i>string</i>. The layout is
invalidated and must be laid out again.</p>
<p>Notice that when using this <a href="qtextlayout.html">QTextLayout</a> as part of a <a href="qtextdocument.html">QTextDocument</a> this method will have no
effect.</p>
<p><b>See also</b> <a href="qtextlayout.html#text">text</a>().</p>
<h3 class="fn"><a name="setTextOption" />QTextLayout.setTextOption (<i>self</i>, <a href="qtextoption.html">QTextOption</a> <i>option</i>)</h3><p>Sets the text option structure that controls the layout process
to the given <i>option</i>.</p>
<p><b>See also</b> <a href="qtextlayout.html#textOption">textOption</a>().</p>
<h3 class="fn"><a name="text" />QString QTextLayout.text (<i>self</i>)</h3><p>Returns the layout's text.</p>
<p><b>See also</b> <a href="qtextlayout.html#setText">setText</a>().</p>
<h3 class="fn"><a name="textOption" /><a href="qtextoption.html">QTextOption</a> QTextLayout.textOption (<i>self</i>)</h3><p>Returns the current text option used to control the layout
process.</p>
<p><b>See also</b> <a href="qtextlayout.html#setTextOption">setTextOption</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|