1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/text/qtextdocumentfragment.cpp -->
7
<title>Qt 4.0: QTextDocumentFragment Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<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="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QTextDocumentFragment Class Reference</h1>
21
<p>The QTextDocumentFragment class represents a piece of formatted text from a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
22
<pre>#include <QTextDocumentFragment></pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
24
<li><a href="qtextdocumentfragment-members.html">List of all members, including inherited members</a></li>
26
<a name="public-functions"></a>
27
<h3>Public Functions</h3>
29
<li><div class="fn"/><b><a href="qtextdocumentfragment.html#QTextDocumentFragment">QTextDocumentFragment</a></b> ()</li>
30
<li><div class="fn"/><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-2">QTextDocumentFragment</a></b> ( const QTextDocument * <i>document</i> )</li>
31
<li><div class="fn"/><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-3">QTextDocumentFragment</a></b> ( const QTextCursor & <i>cursor</i> )</li>
32
<li><div class="fn"/><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-4">QTextDocumentFragment</a></b> ( const QTextDocumentFragment & <i>other</i> )</li>
33
<li><div class="fn"/><b><a href="qtextdocumentfragment.html#dtor.QTextDocumentFragment">~QTextDocumentFragment</a></b> ()</li>
34
<li><div class="fn"/>bool <b><a href="qtextdocumentfragment.html#isEmpty">isEmpty</a></b> () const</li>
35
<li><div class="fn"/>QString <b><a href="qtextdocumentfragment.html#toHtml">toHtml</a></b> () const</li>
36
<li><div class="fn"/>QString <b><a href="qtextdocumentfragment.html#toPlainText">toPlainText</a></b> () const</li>
37
<li><div class="fn"/>QTextDocumentFragment & <b><a href="qtextdocumentfragment.html#operator-eq">operator=</a></b> ( const QTextDocumentFragment & <i>other</i> )</li>
39
<a name="static-public-members"></a>
40
<h3>Static Public Members</h3>
42
<li><div class="fn"/>QTextDocumentFragment <b><a href="qtextdocumentfragment.html#fromHtml">fromHtml</a></b> ( const QString & <i>text</i> )</li>
43
<li><div class="fn"/>QTextDocumentFragment <b><a href="qtextdocumentfragment.html#fromPlainText">fromPlainText</a></b> ( const QString & <i>plainText</i> )</li>
45
<a name="details"></a>
47
<h2>Detailed Description</h2>
48
<p>The QTextDocumentFragment class represents a piece of formatted text from a <a href="qtextdocument.html">QTextDocument</a>.</p>
49
<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>
50
<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>
52
<h2>Member Function Documentation</h2>
53
<h3 class="fn"><a name="QTextDocumentFragment"></a>QTextDocumentFragment::QTextDocumentFragment ()</h3>
54
<p>Constructs an empty <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>.</p>
55
<p>See also <a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>().</p>
56
<h3 class="fn"><a name="QTextDocumentFragment-2"></a>QTextDocumentFragment::QTextDocumentFragment ( const <a href="qtextdocument.html">QTextDocument</a> * <i>document</i> )</h3>
57
<p>Converts the given <i>document</i> into a <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>.</p>
58
<h3 class="fn"><a name="QTextDocumentFragment-3"></a>QTextDocumentFragment::QTextDocumentFragment ( const <a href="qtextcursor.html">QTextCursor</a> & <i>cursor</i> )</h3>
59
<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>
60
<p>See also <a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>() and <a href="qtextcursor.html#selection">QTextCursor::selection</a>().</p>
61
<h3 class="fn"><a name="QTextDocumentFragment-4"></a>QTextDocumentFragment::QTextDocumentFragment ( const QTextDocumentFragment & <i>other</i> )</h3>
62
<p>Copy constructor. Creates a copy of the <i>other</i> fragment.</p>
63
<h3 class="fn"><a name="dtor.QTextDocumentFragment"></a>QTextDocumentFragment::~QTextDocumentFragment ()</h3>
64
<p>Destroys the document fragment.</p>
65
<h3 class="fn"><a name="fromHtml"></a>QTextDocumentFragment QTextDocumentFragment::fromHtml ( const <a href="qstring.html">QString</a> & <i>text</i> ) <tt> [static]</tt></h3>
66
<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>
67
<h3 class="fn"><a name="fromPlainText"></a>QTextDocumentFragment QTextDocumentFragment::fromPlainText ( const <a href="qstring.html">QString</a> & <i>plainText</i> ) <tt> [static]</tt></h3>
68
<p>Returns a document fragment that contains the given <i>plainText</i>.</p>
69
<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>
70
<h3 class="fn"><a name="isEmpty"></a>bool QTextDocumentFragment::isEmpty () const</h3>
71
<p>Returns true if the fragment is empty; otherwise returns false.</p>
72
<h3 class="fn"><a name="toHtml"></a><a href="qstring.html">QString</a> QTextDocumentFragment::toHtml () const</h3>
73
<p>Returns the contents of the document fragment as HTML.</p>
74
<p>See also <a href="qtextdocumentfragment.html#toPlainText">toPlainText</a>().</p>
75
<h3 class="fn"><a name="toPlainText"></a><a href="qstring.html">QString</a> QTextDocumentFragment::toPlainText () const</h3>
76
<p>Returns the document fragment's text as plain text (i.e. with no formatting information).</p>
77
<p>See also <a href="qtextdocumentfragment.html#toHtml">toHtml</a>().</p>
78
<h3 class="fn"><a name="operator-eq"></a>QTextDocumentFragment & QTextDocumentFragment::operator= ( const QTextDocumentFragment & <i>other</i> )</h3>
79
<p>Assigns the <i>other</i> fragment to this fragment.</p>
80
<p /><address><hr /><div align="center">
81
<table width="100%" cellspacing="0" border="0"><tr class="address">
82
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
83
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
84
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
85
</tr></table></div></address></body>