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
|
<?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>QTextDocumentFragment 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">QTextDocumentFragment Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextDocumentFragment class represents a piece of formatted text from a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextdocumentfragment.html#QTextDocumentFragment">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-2">__init__</a></b> (<i>self</i>, QTextDocument <i>document</i>)</li><li><div class="fn" /><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-3">__init__</a></b> (<i>self</i>, QTextCursor <i>range</i>)</li><li><div class="fn" /><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-4">__init__</a></b> (<i>self</i>, QTextDocumentFragment <i>rhs</i>)</li><li><div class="fn" />bool <b><a href="qtextdocumentfragment.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextdocumentfragment.html#toHtml">toHtml</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qtextdocumentfragment.html#toPlainText">toPlainText</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QTextDocumentFragment <b><a href="qtextdocumentfragment.html#fromHtml">fromHtml</a></b> (QString <i>html</i>)</li><li><div class="fn" />QTextDocumentFragment <b><a href="qtextdocumentfragment.html#fromPlainText">fromPlainText</a></b> (QString <i>plainText</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextDocumentFragment class represents a piece of formatted text from a <a href="qtextdocument.html">QTextDocument</a>.</p>
<p>A QTextDocumentFragment is a fragment of rich text, that can be inserted into a <a href="qtextdocument.html">QTextDocument</a>. A document fragment can be created from a <a href="qtextdocument.html">QTextDocument</a>, from a <a href="qtextcursor.html">QTextCursor</a>'s selection, or from another document fragment. Document fragments can also be created by the static functions, <a href="qtextdocumentfragment.html#fromPlainText">fromPlainText</a>() and fromHTML().</p>
<p>The contents of a document fragment can be obtained as plain text by using the <a href="qtextdocumentfragment.html#toPlainText">toPlainText</a>() function, or it can be obtained as HTML with <a href="qtextdocumentfragment.html#toHtml">toHtml</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextDocumentFragment" />QTextDocumentFragment.__init__ (<i>self</i>)</h3><p>Constructs an empty <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>.</p>
<p>See also <a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="QTextDocumentFragment-2" />QTextDocumentFragment.__init__ (<i>self</i>, <a href="qtextdocument.html">QTextDocument</a> <i>document</i>)</h3><p>Converts the given <i>document</i> into a <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>.</p>
<h3 class="fn"><a name="QTextDocumentFragment-3" />QTextDocumentFragment.__init__ (<i>self</i>, <a href="qtextcursor.html">QTextCursor</a> <i>range</i>)</h3><p>Creates a <a href="qtextdocumentfragment.html">QTextDocumentFragment</a> from the <i>cursor</i>'s selection. If the cursor doesn't have a selection, the created fragment is empty.</p>
<p>See also <a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>() and <a href="qtextcursor.html#selection">QTextCursor.selection</a>().</p>
<h3 class="fn"><a name="QTextDocumentFragment-4" />QTextDocumentFragment.__init__ (<i>self</i>, <a href="qtextdocumentfragment.html">QTextDocumentFragment</a> <i>rhs</i>)</h3><p>Copy constructor. Creates a copy of the <i>other</i> fragment.</p>
<h3 class="fn"><a name="fromHtml" /><a href="qtextdocumentfragment.html">QTextDocumentFragment</a> QTextDocumentFragment.fromHtml (<a href="qstring.html">QString</a> <i>html</i>)</h3><p>Returns a <a href="qtextdocumentfragment.html">QTextDocumentFragment</a> based on the arbitrary piece of HTML in the given <i>text</i>. The formatting is preserved as much as possible; for example, "<b>bold</b>" will become a document fragment with the text "bold" with a bold character format.</p>
<h3 class="fn"><a name="fromPlainText" /><a href="qtextdocumentfragment.html">QTextDocumentFragment</a> QTextDocumentFragment.fromPlainText (<a href="qstring.html">QString</a> <i>plainText</i>)</h3><p>Returns a document fragment that contains the given <i>plainText</i>.</p>
<p>When inserting such a fragment into a <a href="qtextdocument.html">QTextDocument</a> the current char format of the <a href="qtextcursor.html">QTextCursor</a> used for insertion is used as format for the text.</p>
<h3 class="fn"><a name="isEmpty" />bool QTextDocumentFragment.isEmpty (<i>self</i>)</h3><p>Returns true if the fragment is empty; otherwise returns false.</p>
<h3 class="fn"><a name="toHtml" /><a href="qstring.html">QString</a> QTextDocumentFragment.toHtml (<i>self</i>)</h3><p>Returns the contents of the document fragment as HTML.</p>
<p>See also <a href="qtextdocumentfragment.html#toPlainText">toPlainText</a>().</p>
<h3 class="fn"><a name="toPlainText" /><a href="qstring.html">QString</a> QTextDocumentFragment.toPlainText (<i>self</i>)</h3><p>Returns the document fragment's text as plain text (i.e. with no formatting information).</p>
<p>See also <a href="qtextdocumentfragment.html#toHtml">toHtml</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.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.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|