Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1154

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QTextBlock 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="index.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">QTextBlock Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextBlock class provides a container for text fragments in
a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />class <b><a href="qtextblock-iterator.html">iterator</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextblock.html#QTextBlock">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#QTextBlock-2">__init__</a></b> (<i>self</i>, QTextBlock&#160;<i>o</i>)</li><li><div class="fn" />iterator <b><a href="qtextblock.html#begin">begin</a></b> (<i>self</i>)</li><li><div class="fn" />QTextBlockFormat <b><a href="qtextblock.html#blockFormat">blockFormat</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#blockFormatIndex">blockFormatIndex</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#blockNumber">blockNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QTextCharFormat <b><a href="qtextblock.html#charFormat">charFormat</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#charFormatIndex">charFormatIndex</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#clearLayout">clearLayout</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#contains">contains</a></b> (<i>self</i>, int&#160;<i>position</i>)</li><li><div class="fn" />QTextDocument <b><a href="qtextblock.html#document">document</a></b> (<i>self</i>)</li><li><div class="fn" />iterator <b><a href="qtextblock.html#end">end</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#firstLineNumber">firstLineNumber</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#isVisible">isVisible</a></b> (<i>self</i>)</li><li><div class="fn" />QTextLayout <b><a href="qtextblock.html#layout">layout</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#length">length</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#lineCount">lineCount</a></b> (<i>self</i>)</li><li><div class="fn" />QTextBlock <b><a href="qtextblock.html#next">next</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#position">position</a></b> (<i>self</i>)</li><li><div class="fn" />QTextBlock <b><a href="qtextblock.html#previous">previous</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#revision">revision</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#setLineCount">setLineCount</a></b> (<i>self</i>, int&#160;<i>count</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#setRevision">setRevision</a></b> (<i>self</i>, int&#160;<i>rev</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#setUserData">setUserData</a></b> (<i>self</i>, QTextBlockUserData&#160;<i>data</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#setUserState">setUserState</a></b> (<i>self</i>, int&#160;<i>state</i>)</li><li><div class="fn" /><b><a href="qtextblock.html#setVisible">setVisible</a></b> (<i>self</i>, bool&#160;<i>visible</i>)</li><li><div class="fn" />QString <b><a href="qtextblock.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.LayoutDirection <b><a href="qtextblock.html#textDirection">textDirection</a></b> (<i>self</i>)</li><li><div class="fn" />QTextList <b><a href="qtextblock.html#textList">textList</a></b> (<i>self</i>)</li><li><div class="fn" />QTextBlockUserData <b><a href="qtextblock.html#userData">userData</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblock.html#userState">userState</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qtextblock.html#__eq__">__eq__</a></b> (<i>self</i>, QTextBlock&#160;<i>o</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#__ge__">__ge__</a></b> (<i>self</i>, QTextBlock&#160;<i>o</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#__lt__">__lt__</a></b> (<i>self</i>, QTextBlock&#160;<i>o</i>)</li><li><div class="fn" />bool <b><a href="qtextblock.html#__ne__">__ne__</a></b> (<i>self</i>, QTextBlock&#160;<i>o</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextBlock class provides a container for text fragments in
a <a href="qtextdocument.html">QTextDocument</a>.</p>
<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>
<p>Text blocks are created by their parent documents. If you need
to create a new text block, or modify the contents of a document
while examining its contents, use the cursor-based interface
provided by <a href="qtextcursor.html">QTextCursor</a> instead.</p>
<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>
<p>The <a href="qtextblock.html#next">next</a>() and <a href="qtextblock.html#previous">previous</a>() functions enable
iteration over consecutive valid blocks in a document under the
condition that the document is not modified by other means during
the iteration process. Note that, although blocks are returned in
sequence, adjacent blocks may come from different places in the
document structure. The validity of a block can be determined by
calling <a href="qtextblock.html#isValid">isValid</a>().</p>
<p>QTextBlock provides comparison operators to make it easier to
work with blocks: <a href="qtextblock.html#operator-eq-eq">operator==</a>() compares two
block for equality, <a href="qtextblock.html#operator-not-eq">operator!=</a>() compares two
blocks for inequality, and <a href="qtextblock.html#operator-lt">operator&lt;</a>() determines whether
a block precedes another in the same document.</p>
<p class="centerAlign"><img alt="" src="images/qtextblock-sequence.png" /></p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextBlock" />QTextBlock.__init__ (<i>self</i>)</h3><p>Copies the <i>other</i> text block's attributes to this text
block.</p>


<h3 class="fn"><a name="QTextBlock-2" />QTextBlock.__init__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>o</i>)</h3><h3 class="fn"><a name="begin" /><a href="qtextblock-iterator.html">iterator</a> QTextBlock.begin (<i>self</i>)</h3><p>Returns a text block iterator pointing to the beginning of the
text block.</p>
<p><b>See also</b> <a href="qtextblock.html#end">end</a>().</p>


<h3 class="fn"><a name="blockFormat" /><a href="qtextblockformat.html">QTextBlockFormat</a> QTextBlock.blockFormat (<i>self</i>)</h3><p>Returns the <a href="qtextblockformat.html">QTextBlockFormat</a>
that describes block-specific properties.</p>
<p><b>See also</b> <a href="qtextblock.html#charFormat">charFormat</a>().</p>


<h3 class="fn"><a name="blockFormatIndex" />int QTextBlock.blockFormatIndex (<i>self</i>)</h3><p>Returns an index into the document's internal list of block
formats for the text block's format.</p>
<p><b>See also</b> <a href="qtextdocument.html#allFormats">QTextDocument.allFormats</a>().</p>


<h3 class="fn"><a name="blockNumber" />int QTextBlock.blockNumber (<i>self</i>)</h3><p>Returns the number of this block, or -1 if the block is
invalid.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextcursor.html#blockNumber">QTextCursor.blockNumber</a>().</p>


<h3 class="fn"><a name="charFormat" /><a href="qtextcharformat.html">QTextCharFormat</a> QTextBlock.charFormat (<i>self</i>)</h3><p>Returns the <a href="qtextcharformat.html">QTextCharFormat</a>
that describes the block's character format. The block's character
format is used when inserting text into an empty block.</p>
<p><b>See also</b> <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>


<h3 class="fn"><a name="charFormatIndex" />int QTextBlock.charFormatIndex (<i>self</i>)</h3><p>Returns an index into the document's internal list of character
formats for the text block's character format.</p>
<p><b>See also</b> <a href="qtextdocument.html#allFormats">QTextDocument.allFormats</a>().</p>


<h3 class="fn"><a name="clearLayout" />QTextBlock.clearLayout (<i>self</i>)</h3><p>Clears the <a href="qtextlayout.html">QTextLayout</a> that is
used to lay out and display the block's contents.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblock.html#layout">layout</a>().</p>


<h3 class="fn"><a name="contains" />bool QTextBlock.contains (<i>self</i>, int&#160;<i>position</i>)</h3><p>Returns true if the given <i>position</i> is located within the
text block; otherwise returns false.</p>


<h3 class="fn"><a name="document" /><a href="qtextdocument.html">QTextDocument</a> QTextBlock.document (<i>self</i>)</h3><p>Returns the text document this text block belongs to, or 0 if
the text block does not belong to any document.</p>


<h3 class="fn"><a name="end" /><a href="qtextblock-iterator.html">iterator</a> QTextBlock.end (<i>self</i>)</h3><p>Returns a text block iterator pointing to the end of the text
block.</p>
<p><b>See also</b> <a href="qtextblock.html#begin">begin</a>(),
<a href="qtextblock.html#next">next</a>(), and <a href="qtextblock.html#previous">previous</a>().</p>


<h3 class="fn"><a name="firstLineNumber" />int QTextBlock.firstLineNumber (<i>self</i>)</h3><p>Returns the first line number of this block, or -1 if the block
is invalid. Unless the layout supports it, the line number is
identical to the block number.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtextblock.html#blockNumber">QTextBlock.blockNumber</a>().</p>


<h3 class="fn"><a name="isValid" />bool QTextBlock.isValid (<i>self</i>)</h3><p>Returns true if this text block is valid; otherwise returns
false.</p>


<h3 class="fn"><a name="isVisible" />bool QTextBlock.isVisible (<i>self</i>)</h3><p>Returns true if the block is visible; otherwise returns
false.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblock.html#setVisible">setVisible</a>().</p>


<h3 class="fn"><a name="layout" /><a href="qtextlayout.html">QTextLayout</a> QTextBlock.layout (<i>self</i>)</h3><p>Returns the <a href="qtextlayout.html">QTextLayout</a> that is
used to lay out and display the block's contents.</p>
<p>Note that the returned <a href="qtextlayout.html">QTextLayout</a> object can only be modified from
the documentChanged implementation of a <a href="qabstracttextdocumentlayout.html">QAbstractTextDocumentLayout</a>
subclass. Any changes applied from the outside cause undefined
behavior.</p>
<p><b>See also</b> <a href="qtextblock.html#clearLayout">clearLayout</a>().</p>


<h3 class="fn"><a name="length" />int QTextBlock.length (<i>self</i>)</h3><p>Returns the length of the block in characters.</p>
<p><b>Note:</b> The length returned includes all formatting
characters, for example, newline.</p>
<p><b>See also</b> <a href="qtextblock.html#text">text</a>(),
<a href="qtextblock.html#charFormat">charFormat</a>(), and <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>


<h3 class="fn"><a name="lineCount" />int QTextBlock.lineCount (<i>self</i>)</h3><p>Returns the line count. Not all document layouts support this
feature.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtextblock.html#setLineCount">setLineCount</a>().</p>


<h3 class="fn"><a name="next" /><a href="qtextblock.html">QTextBlock</a> QTextBlock.next (<i>self</i>)</h3><p>Returns the text block in the document after this block, or an
empty text block if this is the last one.</p>
<p>Note that the next block may be in a different frame or table to
this block.</p>
<p><b>See also</b> <a href="qtextblock.html#previous">previous</a>(), <a href="qtextblock.html#begin">begin</a>(), and <a href="qtextblock.html#end">end</a>().</p>


<h3 class="fn"><a name="position" />int QTextBlock.position (<i>self</i>)</h3><p>Returns the index of the block's first character within the
document.</p>


<h3 class="fn"><a name="previous" /><a href="qtextblock.html">QTextBlock</a> QTextBlock.previous (<i>self</i>)</h3><p>Returns the text block in the document before this block, or an
empty text block if this is the first one.</p>
<p>Note that the next block may be in a different frame or table to
this block.</p>
<p><b>See also</b> <a href="qtextblock.html#next">next</a>(),
<a href="qtextblock.html#begin">begin</a>(), and <a href="qtextblock.html#end">end</a>().</p>


<h3 class="fn"><a name="revision" />int QTextBlock.revision (<i>self</i>)</h3><p>Returns the blocks revision.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblock.html#setRevision">setRevision</a>() and <a href="qtextdocument.html#revision">QTextDocument.revision</a>().</p>


<h3 class="fn"><a name="setLineCount" />QTextBlock.setLineCount (<i>self</i>, int&#160;<i>count</i>)</h3><p>Sets the line count to <i>count</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qtextblock.html#lineCount">lineCount</a>().</p>


<h3 class="fn"><a name="setRevision" />QTextBlock.setRevision (<i>self</i>, int&#160;<i>rev</i>)</h3><p>Sets a blocks revision to <i>rev</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblock.html#revision">revision</a>() and <a href="qtextdocument.html#revision">QTextDocument.revision</a>().</p>


<h3 class="fn"><a name="setUserData" />QTextBlock.setUserData (<i>self</i>, <a href="qtextblockuserdata.html">QTextBlockUserData</a>&#160;<i>data</i>)</h3><p>Attaches the given <i>data</i> object to the text block.</p>
<p><a href="qtextblockuserdata.html">QTextBlockUserData</a> can be
used to store custom settings. The ownership is passed to the
underlying text document, i.e. the provided <a href="qtextblockuserdata.html">QTextBlockUserData</a> object will be
deleted if the corresponding text block gets deleted. The user data
object is not stored in the undo history, so it will not be
available after undoing the deletion of a text block.</p>
<p>For example, if you write a programming editor in an IDE, you
may want to let your user set breakpoints visually in your code for
an integrated debugger. In a programming editor a line of text
usually corresponds to one <a href="qtextblock.html">QTextBlock</a>. The <a href="qtextblockuserdata.html">QTextBlockUserData</a> interface allows
the developer to store data for each <a href="qtextblock.html">QTextBlock</a>, like for example in which lines
of the source code the user has a breakpoint set. Of course this
could also be stored externally, but by storing it inside the
<a href="qtextdocument.html">QTextDocument</a>, it will for example
be automatically deleted when the user deletes the associated line.
It's really just a way to store custom information in the <a href="qtextdocument.html">QTextDocument</a> without using custom
properties in <a href="qtextformat.html">QTextFormat</a> which
would affect the undo/redo stack.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtextblock.html#userData">userData</a>().</p>


<h3 class="fn"><a name="setUserState" />QTextBlock.setUserState (<i>self</i>, int&#160;<i>state</i>)</h3><p>Stores the specified <i>state</i> integer value in the text
block. This may be useful for example in a syntax highlighter to
store a text parsing state.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtextblock.html#userState">userState</a>().</p>


<h3 class="fn"><a name="setVisible" />QTextBlock.setVisible (<i>self</i>, bool&#160;<i>visible</i>)</h3><p>Sets the block's visibility to <i>visible</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblock.html#isVisible">isVisible</a>().</p>


<h3 class="fn"><a name="text" />QString QTextBlock.text (<i>self</i>)</h3><p>Returns the block's contents as plain text.</p>
<p><b>See also</b> <a href="qtextblock.html#length">length</a>(),
<a href="qtextblock.html#charFormat">charFormat</a>(), and <a href="qtextblock.html#blockFormat">blockFormat</a>().</p>


<h3 class="fn"><a name="textDirection" /><a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a> QTextBlock.textDirection (<i>self</i>)</h3><p>Returns the resolved text direction.</p>
<p>If the block has no explicit direction set, it will resolve the
direction from the blocks content. Returns either <a href="qt.html#LayoutDirection-enum">Qt.LeftToRight</a> or <a href="qt.html#LayoutDirection-enum">Qt.RightToLeft</a>.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qtextformat.html#layoutDirection">QTextFormat.layoutDirection</a>(),
<a href="qstring.html#isRightToLeft">QString.isRightToLeft</a>(),
and <a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a>.</p>


<h3 class="fn"><a name="textList" /><a href="qtextlist.html">QTextList</a> QTextBlock.textList (<i>self</i>)</h3><p>If the block represents a list item, returns the list that the
item belongs to; otherwise returns 0.</p>


<h3 class="fn"><a name="userData" /><a href="qtextblockuserdata.html">QTextBlockUserData</a> QTextBlock.userData (<i>self</i>)</h3><p>Returns a pointer to a <a href="qtextblockuserdata.html">QTextBlockUserData</a> object if
previously set with <a href="qtextblock.html#setUserData">setUserData</a>() or a null
pointer.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtextblock.html#setUserData">setUserData</a>().</p>


<h3 class="fn"><a name="userState" />int QTextBlock.userState (<i>self</i>)</h3><p>Returns the integer value previously set with <a href="qtextblock.html#setUserState">setUserState</a>() or -1.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qtextblock.html#setUserState">setUserState</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QTextBlock.__eq__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>o</i>)</h3><h3 class="fn"><a name="__ge__" />bool QTextBlock.__ge__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>o</i>)</h3><h3 class="fn"><a name="__lt__" />bool QTextBlock.__lt__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>o</i>)</h3><h3 class="fn"><a name="__ne__" />bool QTextBlock.__ne__ (<i>self</i>, <a href="qtextblock.html">QTextBlock</a>&#160;<i>o</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 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.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>