<class name="QTextBlock" doc="/**
&lt;p&gt;The &lt;a href=&quot;QTextBlock.html#QTextBlock(com.trolltech.qt.gui.QTextBlock)&quot;&gt;&lt;tt&gt;QTextBlock&lt;/tt&gt;&lt;/a&gt; class provides a container for text fragments in a &lt;a href=&quot;QTextDocument.html&quot;&gt;&lt;tt&gt;QTextDocument&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A text block encapsulates a block or paragraph of text in a &lt;a href=&quot;QTextDocument.html&quot;&gt;&lt;tt&gt;QTextDocument&lt;/tt&gt;&lt;/a&gt;. &lt;a href=&quot;QTextBlock.html#QTextBlock(com.trolltech.qt.gui.QTextBlock)&quot;&gt;&lt;tt&gt;QTextBlock&lt;/tt&gt;&lt;/a&gt; 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 &lt;a href=&quot;QTextDocument.html&quot;&gt;&lt;tt&gt;QTextDocument&lt;/tt&gt;&lt;/a&gt;, or if you want to iterate over a document and write out the contents in your own custom format.&lt;/p&gt;
&lt;p&gt;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 &lt;a href=&quot;QTextCursor.html&quot;&gt;&lt;tt&gt;QTextCursor&lt;/tt&gt;&lt;/a&gt; instead.&lt;/p&gt;
&lt;p&gt;Each text block is located at a specific &lt;a href=&quot;QTextBlock.html#position()&quot;&gt;&lt;tt&gt;position&lt;/tt&gt;&lt;/a&gt; in a &lt;a href=&quot;QTextBlock.html#document()&quot;&gt;&lt;tt&gt;document&lt;/tt&gt;&lt;/a&gt;. The contents of the block can be obtained by using the &lt;a href=&quot;QTextBlock.html#text()&quot;&gt;&lt;tt&gt;text&lt;/tt&gt;&lt;/a&gt; function. The &lt;a href=&quot;QTextBlock.html#length()&quot;&gt;&lt;tt&gt;length&lt;/tt&gt;&lt;/a&gt; function determines the block's size within the document (including formatting characters). The visual properties of the block are determined by its text &lt;a href=&quot;QTextBlock.html#layout()&quot;&gt;&lt;tt&gt;layout&lt;/tt&gt;&lt;/a&gt;, its &lt;a href=&quot;QTextBlock.html#charFormat()&quot;&gt;&lt;tt&gt;charFormat&lt;/tt&gt;&lt;/a&gt;, and its &lt;a href=&quot;QTextBlock.html#blockFormat()&quot;&gt;&lt;tt&gt;blockFormat&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;QTextBlock.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QTextBlock.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt; 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 &lt;a href=&quot;QTextBlock.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QTextBlock.html#QTextBlock(com.trolltech.qt.gui.QTextBlock)&quot;&gt;&lt;tt&gt;QTextBlock&lt;/tt&gt;&lt;/a&gt; provides comparison operators to make it easier to work with blocks: &lt;tt&gt;operator==&lt;/tt&gt; compares two block for equality, &lt;tt&gt;operator!=&lt;/tt&gt; compares two blocks for inequality, and &lt;tt&gt;operator&amp;lt;&lt;/tt&gt; determines whether a block precedes another in the same document.&lt;/p&gt;
&lt;p align=&quot;center&quot;&gt;&lt;img src=&quot;%2E%2E/images/qtextblock-sequence.png&quot; /&gt;&lt;/p&gt;
@see &lt;a href=&quot;QTextBlockFormat.html&quot;&gt;&lt;tt&gt;QTextBlockFormat&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextCharFormat.html&quot;&gt;&lt;tt&gt;QTextCharFormat&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextFragment.html&quot;&gt;&lt;tt&gt;QTextFragment&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public QTextBlock()" doc="/**
&lt;p&gt;&lt;/p&gt;
 */"/>
    <method name="public QTextBlock(com.trolltech.qt.gui.QTextBlock o)" doc="/**
&lt;p&gt;Copies the &lt;tt&gt;o&lt;/tt&gt; text block's attributes to this text block.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlock_iterator begin()" doc="/**
&lt;p&gt;Returns a text block iterator pointing to the beginning of the text block.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#end()&quot;&gt;&lt;tt&gt;end&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlockFormat blockFormat()" doc="/**
&lt;p&gt;Returns the &lt;a href=&quot;QTextBlockFormat.html&quot;&gt;&lt;tt&gt;QTextBlockFormat&lt;/tt&gt;&lt;/a&gt; that describes block-specific properties.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#charFormat()&quot;&gt;&lt;tt&gt;charFormat&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int blockFormatIndex()" doc="/**
&lt;p&gt;Returns an index into the document's internal list of block formats for the text block's format.&lt;/p&gt;

@see &lt;tt&gt;QTextDocument::object&lt;/tt&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QTextCharFormat charFormat()" doc="/**
&lt;p&gt;Returns the &lt;a href=&quot;QTextCharFormat.html&quot;&gt;&lt;tt&gt;QTextCharFormat&lt;/tt&gt;&lt;/a&gt; that describes the block's character format. The block's character format is used when inserting text into an empty block.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#blockFormat()&quot;&gt;&lt;tt&gt;blockFormat&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int charFormatIndex()" doc="/**
&lt;p&gt;Returns an index into the document's internal list of character formats for the text block's character format.&lt;/p&gt;

@see &lt;tt&gt;QTextDocument::object&lt;/tt&gt; */"/>
    <method name="public final boolean contains(int position)" doc="/**
&lt;p&gt;Returns true if the given &lt;tt&gt;position&lt;/tt&gt; is located within the text block; otherwise returns false.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextDocument document()" doc="/**
&lt;p&gt;Returns the text document this text block belongs to, or 0 if the text block does not belong to any document.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlock_iterator end()" doc="/**
&lt;p&gt;Returns a text block iterator pointing to the end of the text block.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#begin()&quot;&gt;&lt;tt&gt;begin&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isValid()" doc="/**
&lt;p&gt;Returns true if this text block is valid; otherwise returns false.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextLayout layout()" doc="/**
&lt;p&gt;Returns the &lt;a href=&quot;QTextLayout.html&quot;&gt;&lt;tt&gt;QTextLayout&lt;/tt&gt;&lt;/a&gt; that is used to lay out and display the block's contents.&lt;/p&gt;
&lt;p&gt;Note that the returned &lt;a href=&quot;QTextLayout.html&quot;&gt;&lt;tt&gt;QTextLayout&lt;/tt&gt;&lt;/a&gt; object can only be modified from the documentChanged implementation of a &lt;a href=&quot;QAbstractTextDocumentLayout.html&quot;&gt;&lt;tt&gt;QAbstractTextDocumentLayout&lt;/tt&gt;&lt;/a&gt; subclass. Any changes applied from the outside cause undefined behavior.&lt;/p&gt;
 */"/>
    <method name="public final int length()" doc="/**
&lt;p&gt;Returns the length of the block in characters.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#text()&quot;&gt;&lt;tt&gt;text&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#charFormat()&quot;&gt;&lt;tt&gt;charFormat&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#blockFormat()&quot;&gt;&lt;tt&gt;blockFormat&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlock next()" doc="/**
&lt;p&gt;Returns the text block in the document after this block, or an empty text block if this is the last one.&lt;/p&gt;
&lt;p&gt;Note that the next block may be in a different frame or table to this block.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#begin()&quot;&gt;&lt;tt&gt;begin&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#end()&quot;&gt;&lt;tt&gt;end&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int position()" doc="/**
&lt;p&gt;Returns the index of the block's first character within the document.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlock previous()" doc="/**
&lt;p&gt;Returns the text block in the document before this block, or an empty text block if this is the first one.&lt;/p&gt;
&lt;p&gt;Note that the next block may be in a different frame or table to this block.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#begin()&quot;&gt;&lt;tt&gt;begin&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#end()&quot;&gt;&lt;tt&gt;end&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setUserData(com.trolltech.qt.gui.QTextBlockUserData data)" doc="/**
&lt;p&gt;Attaches the given &lt;tt&gt;data&lt;/tt&gt; object to the text block.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QTextBlockUserData.html&quot;&gt;&lt;tt&gt;QTextBlockUserData&lt;/tt&gt;&lt;/a&gt; can be used to store custom settings. The ownership is passed to the underlying text document, i.e&amp;#x2e; the provided &lt;a href=&quot;QTextBlockUserData.html&quot;&gt;&lt;tt&gt;QTextBlockUserData&lt;/tt&gt;&lt;/a&gt; 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.&lt;/p&gt;
&lt;p&gt;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 &lt;a href=&quot;QTextBlock.html#QTextBlock(com.trolltech.qt.gui.QTextBlock)&quot;&gt;&lt;tt&gt;QTextBlock&lt;/tt&gt;&lt;/a&gt;. The &lt;a href=&quot;QTextBlockUserData.html&quot;&gt;&lt;tt&gt;QTextBlockUserData&lt;/tt&gt;&lt;/a&gt; interface allows the developer to store data for each &lt;a href=&quot;QTextBlock.html#QTextBlock(com.trolltech.qt.gui.QTextBlock)&quot;&gt;&lt;tt&gt;QTextBlock&lt;/tt&gt;&lt;/a&gt;, 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 &lt;a href=&quot;QTextDocument.html&quot;&gt;&lt;tt&gt;QTextDocument&lt;/tt&gt;&lt;/a&gt;, 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 &lt;a href=&quot;QTextDocument.html&quot;&gt;&lt;tt&gt;QTextDocument&lt;/tt&gt;&lt;/a&gt; without using custom properties in &lt;a href=&quot;QTextFormat.html&quot;&gt;&lt;tt&gt;QTextFormat&lt;/tt&gt;&lt;/a&gt; which would affect the undo/redo stack.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#userData()&quot;&gt;&lt;tt&gt;userData&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setUserState(int state)" doc="/**
&lt;p&gt;Stores the specified &lt;tt&gt;state&lt;/tt&gt; integer value in the text block. This may be useful for example in a syntax highlighter to store a text parsing state.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#userState()&quot;&gt;&lt;tt&gt;userState&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final java.lang.String text()" doc="/**
&lt;p&gt;Returns the block's contents as plain text.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#length()&quot;&gt;&lt;tt&gt;length&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#charFormat()&quot;&gt;&lt;tt&gt;charFormat&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTextBlock.html#blockFormat()&quot;&gt;&lt;tt&gt;blockFormat&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.gui.QTextList textList()" doc="/**
&lt;p&gt;If the block represents a list item, returns the list that the item belongs to; otherwise returns 0.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.gui.QTextBlockUserData userData()" doc="/**
&lt;p&gt;Returns a pointer to a &lt;a href=&quot;QTextBlockUserData.html&quot;&gt;&lt;tt&gt;QTextBlockUserData&lt;/tt&gt;&lt;/a&gt; object if previously set with &lt;a href=&quot;QTextBlock.html#setUserData(com.trolltech.qt.gui.QTextBlockUserData)&quot;&gt;&lt;tt&gt;setUserData&lt;/tt&gt;&lt;/a&gt; or a null pointer.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#setUserData(com.trolltech.qt.gui.QTextBlockUserData)&quot;&gt;&lt;tt&gt;setUserData&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int userState()" doc="/**
&lt;p&gt;Returns the integer value previously set with &lt;a href=&quot;QTextBlock.html#setUserState(int)&quot;&gt;&lt;tt&gt;setUserState&lt;/tt&gt;&lt;/a&gt; or -1.&lt;/p&gt;

@see &lt;a href=&quot;QTextBlock.html#setUserState(int)&quot;&gt;&lt;tt&gt;setUserState&lt;/tt&gt;&lt;/a&gt; */"/>
</class>
