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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtextdocumentfragment.cpp -->
<title>Qt 4.8: QTextDocumentFragment Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QTextDocumentFragment</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QTextDocumentFragment Class Reference</h1>
<!-- $$$QTextDocumentFragment-brief -->
<p>The QTextDocumentFragment class represents a piece of formatted text from a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
<!-- @@@QTextDocumentFragment -->
<pre class="cpp"> <span class="preprocessor">#include <QTextDocumentFragment></span></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qtextdocumentfragment-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#QTextDocumentFragment">QTextDocumentFragment</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-2">QTextDocumentFragment</a></b> ( const QTextDocument * <i>document</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-3">QTextDocumentFragment</a></b> ( const QTextCursor & <i>cursor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#QTextDocumentFragment-4">QTextDocumentFragment</a></b> ( const QTextDocumentFragment & <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#dtor.QTextDocumentFragment">~QTextDocumentFragment</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#toHtml">toHtml</a></b> ( const QByteArray & <i>encoding</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#toHtml-2">toHtml</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#toPlainText">toPlainText</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocumentFragment & </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#operator-eq">operator=</a></b> ( const QTextDocumentFragment & <i>other</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocumentFragment </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#fromHtml">fromHtml</a></b> ( const QString & <i>text</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocumentFragment </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#fromHtml-2">fromHtml</a></b> ( const QString & <i>text</i>, const QTextDocument * <i>resourceProvider</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocumentFragment </td><td class="memItemRight bottomAlign"><b><a href="qtextdocumentfragment.html#fromPlainText">fromPlainText</a></b> ( const QString & <i>plainText</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QTextDocumentFragment-description -->
<div class="descr">
<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 <a href="qtextdocumentfragment.html#fromHtml">fromHtml</a>().</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>
</div>
<!-- @@@QTextDocumentFragment -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextDocumentFragment[overload1]$$$QTextDocumentFragment -->
<h3 class="fn"><a name="QTextDocumentFragment"></a>QTextDocumentFragment::<span class="name">QTextDocumentFragment</span> ()</h3>
<p>Constructs an empty <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>.</p>
<p><b>See also </b><a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>().</p>
<!-- @@@QTextDocumentFragment -->
<!-- $$$QTextDocumentFragment$$$QTextDocumentFragmentconstQTextDocument* -->
<h3 class="fn"><a name="QTextDocumentFragment-2"></a>QTextDocumentFragment::<span class="name">QTextDocumentFragment</span> ( const <span class="type"><a href="qtextdocument.html">QTextDocument</a></span> * <i>document</i> )</h3>
<p>Converts the given <i>document</i> into a <a href="qtextdocumentfragment.html">QTextDocumentFragment</a>. Note that the <a href="qtextdocumentfragment.html">QTextDocumentFragment</a> only stores the document contents, not meta information like the document's title.</p>
<!-- @@@QTextDocumentFragment -->
<!-- $$$QTextDocumentFragment$$$QTextDocumentFragmentconstQTextCursor& -->
<h3 class="fn"><a name="QTextDocumentFragment-3"></a>QTextDocumentFragment::<span class="name">QTextDocumentFragment</span> ( const <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> & <i>cursor</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><b>See also </b><a href="qtextdocumentfragment.html#isEmpty">isEmpty</a>() and <a href="qtextcursor.html#selection">QTextCursor::selection</a>().</p>
<!-- @@@QTextDocumentFragment -->
<!-- $$$QTextDocumentFragment$$$QTextDocumentFragmentconstQTextDocumentFragment& -->
<h3 class="fn"><a name="QTextDocumentFragment-4"></a>QTextDocumentFragment::<span class="name">QTextDocumentFragment</span> ( const <span class="type">QTextDocumentFragment</span> & <i>other</i> )</h3>
<p>Copy constructor. Creates a copy of the <i>other</i> fragment.</p>
<!-- @@@QTextDocumentFragment -->
<!-- $$$~QTextDocumentFragment[overload1]$$$~QTextDocumentFragment -->
<h3 class="fn"><a name="dtor.QTextDocumentFragment"></a>QTextDocumentFragment::<span class="name">~QTextDocumentFragment</span> ()</h3>
<p>Destroys the document fragment.</p>
<!-- @@@~QTextDocumentFragment -->
<!-- $$$fromHtml[overload1]$$$fromHtmlconstQString& -->
<h3 class="fn"><a name="fromHtml"></a><span class="type">QTextDocumentFragment</span> QTextDocumentFragment::<span class="name">fromHtml</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i> )<tt> [static]</tt></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>
<!-- @@@fromHtml -->
<!-- $$$fromHtml$$$fromHtmlconstQString&constQTextDocument* -->
<h3 class="fn"><a name="fromHtml-2"></a><span class="type">QTextDocumentFragment</span> QTextDocumentFragment::<span class="name">fromHtml</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, const <span class="type"><a href="qtextdocument.html">QTextDocument</a></span> * <i>resourceProvider</i> )<tt> [static]</tt></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>
<p>If the provided HTML contains references to external resources such as imported style sheets, then they will be loaded through the <i>resourceProvider</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@fromHtml -->
<!-- $$$fromPlainText[overload1]$$$fromPlainTextconstQString& -->
<h3 class="fn"><a name="fromPlainText"></a><span class="type">QTextDocumentFragment</span> QTextDocumentFragment::<span class="name">fromPlainText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>plainText</i> )<tt> [static]</tt></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>
<!-- @@@fromPlainText -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a><span class="type">bool</span> QTextDocumentFragment::<span class="name">isEmpty</span> () const</h3>
<p>Returns true if the fragment is empty; otherwise returns false.</p>
<!-- @@@isEmpty -->
<!-- $$$toHtml[overload1]$$$toHtmlconstQByteArray& -->
<h3 class="fn"><a name="toHtml"></a><span class="type"><a href="qstring.html">QString</a></span> QTextDocumentFragment::<span class="name">toHtml</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>encoding</i> ) const</h3>
<p>Returns the contents of the document fragment as HTML, using the specified <i>encoding</i> (e.g., "UTF-8", "ISO 8859-1").</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qtextdocumentfragment.html#toPlainText">toPlainText</a>(), <a href="qtextdocument.html#toHtml">QTextDocument::toHtml</a>(), and <a href="qtextcodec.html">QTextCodec</a>.</p>
<!-- @@@toHtml -->
<!-- $$$toHtml$$$toHtml -->
<h3 class="fn"><a name="toHtml-2"></a><span class="type"><a href="qstring.html">QString</a></span> QTextDocumentFragment::<span class="name">toHtml</span> () const</h3>
<p>This is an overloaded function.</p>
<!-- @@@toHtml -->
<!-- $$$toPlainText[overload1]$$$toPlainText -->
<h3 class="fn"><a name="toPlainText"></a><span class="type"><a href="qstring.html">QString</a></span> QTextDocumentFragment::<span class="name">toPlainText</span> () const</h3>
<p>Returns the document fragment's text as plain text (i.e. with no formatting information).</p>
<p><b>See also </b><a href="qtextdocumentfragment.html#toHtml">toHtml</a>().</p>
<!-- @@@toPlainText -->
<!-- $$$operator=[overload1]$$$operator=constQTextDocumentFragment& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QTextDocumentFragment</span> & QTextDocumentFragment::<span class="name">operator=</span> ( const <span class="type">QTextDocumentFragment</span> & <i>other</i> )</h3>
<p>Assigns the <i>other</i> fragment to this fragment.</p>
<!-- @@@operator= -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|