<?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>QTextObject 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="../pyqt4ref.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">QTextObject Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextObject class is a base class for different kinds of objects that can group parts of a <a href="qtextdocument.html">QTextDocument</a> together. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qtextblockgroup.html">QTextBlockGroup</a> and <a href="qtextframe.html">QTextFrame</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextobject.html#QTextObject">__init__</a></b> (<i>self</i>, QTextDocument)</li><li><div class="fn" />QTextDocument <b><a href="qtextobject.html#document">document</a></b> (<i>self</i>)</li><li><div class="fn" />QTextFormat <b><a href="qtextobject.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextobject.html#formatIndex">formatIndex</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextobject.html#objectIndex">objectIndex</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextobject.html#setFormat">setFormat</a></b> (<i>self</i>, QTextFormat)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextObject class is a base class for different kinds of objects that can group parts of a <a href="qtextdocument.html">QTextDocument</a> together.</p> <p>The common grouping text objects are lists (<a href="qtextlist.html">QTextList</a>), frames (<a href="qtextframe.html">QTextFrame</a>), and tables (<a href="qtexttable.html">QTextTable</a>). A text object has an associated <a href="qtextobject.html#format">format</a>() and <a href="qtextobject.html#document">document</a>().</p> <p>There are essentially two kinds of text objects: those that are used with blocks (block formats), and those that are used with characters (character formats). The first kind are derived from <a href="qtextblockgroup.html">QTextBlockGroup</a>, and the second kind from <a href="qtextframe.html">QTextFrame</a>.</p> <p>You rarely need to use this class directly. When creating custom text objects, you will also need to reimplement <a href="qtextdocument.html#createObject">QTextDocument.createObject</a>() which acts as a factory method for creating text objects.</p> <p>See also <a href="qtextdocument.html">QTextDocument</a> and <a href="richtext-textobject.html">Text Object Example</a>.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextObject" />QTextObject.__init__ (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a>)</h3><p>Creates a new <a href="qtextobject.html">QTextObject</a> for the given <i>document</i>.</p> <p><b>Warning:</b> This function should never be called directly, but only from <a href="qtextdocument.html#createObject">QTextDocument.createObject</a>().</p> <a name="//apple_ref/cpp/instm/QTextObject/~QTextObject" /> <h3 class="fn"><a name="document" /><a href="qtextdocument.html">QTextDocument</a> QTextObject.document (<i>self</i>)</h3><p>Returns the document this object belongs to.</p> <p>See also <a href="qtextobject.html#format">format</a>().</p> <a name="//apple_ref/cpp/instm/QTextObject/format" /> <h3 class="fn"><a name="format" /><a href="qtextformat.html">QTextFormat</a> QTextObject.format (<i>self</i>)</h3><p>Returns the text object's format.</p> <p>See also <a href="qtextobject.html#setFormat">setFormat</a>() and <a href="qtextobject.html#document">document</a>().</p> <a name="//apple_ref/cpp/instm/QTextObject/formatIndex" /> <h3 class="fn"><a name="formatIndex" />int QTextObject.formatIndex (<i>self</i>)</h3><p>Returns the index of the object's format in the document's internal list of formats.</p> <p>See also <a href="qtextdocument.html#allFormats">QTextDocument.allFormats</a>().</p> <a name="//apple_ref/cpp/instm/QTextObject/objectIndex" /> <h3 class="fn"><a name="objectIndex" />int QTextObject.objectIndex (<i>self</i>)</h3><p>Returns the object index of this object. This can be used together with <a href="qtextformat.html#setObjectIndex">QTextFormat.setObjectIndex</a>().</p> <a name="//apple_ref/cpp/instm/QTextObject/setFormat" /> <h3 class="fn"><a name="setFormat" />QTextObject.setFormat (<i>self</i>, <a href="qtextformat.html">QTextFormat</a>)</h3><p>Sets the text object's <i>format</i>.</p> <p>See also <a href="qtextobject.html#format">format</a>().</p> <p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.4 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>