Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 1607

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtextdocument.cpp -->
  <title>QTextDocument Class | Qt GUI 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTextDocument</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QTextDocument Class</h1>
<!-- $$$QTextDocument-brief -->
<p>The <a href="qtextdocument.html">QTextDocument</a> class holds formatted text. <a href="#details">More...</a></p>
<!-- @@@QTextDocument -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTextDocument&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qtextdocument-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#FindFlag-enum">FindFlag</a></b> { FindBackward, FindCaseSensitively, FindWholeWords }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#MetaInformation-enum">MetaInformation</a></b> { DocumentTitle, DocumentUrl }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#ResourceType-enum">ResourceType</a></b> { HtmlResource, ImageResource, StyleSheetResource, UserResource }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#Stacks-enum">Stacks</a></b> { UndoStack, RedoStack, UndoAndRedoStacks }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<div class="table"><table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qtextdocument.html#baseUrl-prop">baseUrl</a></b> : QUrl</li>
<li class="fn"><b><a href="qtextdocument.html#blockCount-prop">blockCount</a></b> : const int</li>
<li class="fn"><b><a href="qtextdocument.html#defaultFont-prop">defaultFont</a></b> : QFont</li>
<li class="fn"><b><a href="qtextdocument.html#defaultStyleSheet-prop">defaultStyleSheet</a></b> : QString</li>
<li class="fn"><b><a href="qtextdocument.html#defaultTextOption-prop">defaultTextOption</a></b> : QTextOption</li>
<li class="fn"><b><a href="qtextdocument.html#documentMargin-prop">documentMargin</a></b> : qreal</li>
<li class="fn"><b><a href="qtextdocument.html#indentWidth-prop">indentWidth</a></b> : qreal</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qtextdocument.html#maximumBlockCount-prop">maximumBlockCount</a></b> : int</li>
<li class="fn"><b><a href="qtextdocument.html#modified-prop">modified</a></b> : bool</li>
<li class="fn"><b><a href="qtextdocument.html#pageSize-prop">pageSize</a></b> : QSizeF</li>
<li class="fn"><b><a href="qtextdocument.html#size-prop">size</a></b> : const QSizeF</li>
<li class="fn"><b><a href="qtextdocument.html#textWidth-prop">textWidth</a></b> : qreal</li>
<li class="fn"><b><a href="qtextdocument.html#undoRedoEnabled-prop">undoRedoEnabled</a></b> : bool</li>
<li class="fn"><b><a href="qtextdocument.html#useDesignMetrics-prop">useDesignMetrics</a></b> : bool</li>
</ul>
</td></tr>
</table></div>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#QTextDocument">QTextDocument</a></b>(QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#QTextDocument-1">QTextDocument</a></b>(const QString &amp;<i>text</i>, QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#dtor.QTextDocument">~QTextDocument</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#addResource">addResource</a></b>(int <i>type</i>, const QUrl &amp;<i>name</i>, const QVariant &amp;<i>resource</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#adjustSize">adjustSize</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVector&lt;QTextFormat&gt; </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#allFormats">allFormats</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#availableRedoSteps">availableRedoSteps</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#availableUndoSteps">availableUndoSteps</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QUrl </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#baseUrl-prop">baseUrl</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#begin">begin</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#blockCount-prop">blockCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QChar </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#characterAt">characterAt</a></b>(int <i>pos</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#characterCount">characterCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#clear">clear</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#clearUndoRedoStacks">clearUndoRedoStacks</a></b>(Stacks <i>stacksToClear</i> = UndoAndRedoStacks)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocument *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#clone">clone</a></b>(QObject *<i>parent</i> = Q_NULLPTR) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::CursorMoveStyle </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#defaultCursorMoveStyle">defaultCursorMoveStyle</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#defaultFont">defaultFont</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#defaultStyleSheet-prop">defaultStyleSheet</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextOption </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#defaultTextOption">defaultTextOption</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractTextDocumentLayout *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#documentLayout">documentLayout</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#documentMargin-prop">documentMargin</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#drawContents">drawContents</a></b>(QPainter *<i>p</i>, const QRectF &amp;<i>rect</i> = QRectF())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#end">end</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find">find</a></b>(const QString &amp;<i>subString</i>, const QTextCursor &amp;<i>cursor</i>, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find-1">find</a></b>(const QString &amp;<i>subString</i>, int <i>position</i> = 0, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find-2">find</a></b>(const QRegExp &amp;<i>expr</i>, int <i>from</i> = 0, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find-3">find</a></b>(const QRegExp &amp;<i>expr</i>, const QTextCursor &amp;<i>cursor</i>, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find-4">find</a></b>(const QRegularExpression &amp;<i>expr</i>, int <i>from</i> = 0, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#find-5">find</a></b>(const QRegularExpression &amp;<i>expr</i>, const QTextCursor &amp;<i>cursor</i>, FindFlags <i>options</i> = FindFlags()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#findBlock">findBlock</a></b>(int <i>pos</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#findBlockByLineNumber">findBlockByLineNumber</a></b>(int <i>lineNumber</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#findBlockByNumber">findBlockByNumber</a></b>(int <i>blockNumber</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#firstBlock">firstBlock</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#idealWidth">idealWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#indentWidth-prop">indentWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#isEmpty">isEmpty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#modified-prop">isModified</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#isRedoAvailable">isRedoAvailable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#isUndoAvailable">isUndoAvailable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undoRedoEnabled-prop">isUndoRedoEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#lastBlock">lastBlock</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#lineCount">lineCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#markContentsDirty">markContentsDirty</a></b>(int <i>position</i>, int <i>length</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#maximumBlockCount-prop">maximumBlockCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#metaInformation">metaInformation</a></b>(MetaInformation <i>info</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextObject *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#object">object</a></b>(int <i>objectIndex</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextObject *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#objectForFormat">objectForFormat</a></b>(const QTextFormat &amp;<i>f</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#pageCount">pageCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSizeF </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#pageSize-prop">pageSize</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#print">print</a></b>(QPagedPaintDevice *<i>printer</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#redo">redo</a></b>(QTextCursor *<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#resource">resource</a></b>(int <i>type</i>, const QUrl &amp;<i>name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#revision">revision</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextFrame *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#rootFrame">rootFrame</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#baseUrl-prop">setBaseUrl</a></b>(const QUrl &amp;<i>url</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setDefaultCursorMoveStyle">setDefaultCursorMoveStyle</a></b>(Qt::CursorMoveStyle <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setDefaultFont">setDefaultFont</a></b>(const QFont &amp;<i>font</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#defaultStyleSheet-prop">setDefaultStyleSheet</a></b>(const QString &amp;<i>sheet</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setDefaultTextOption">setDefaultTextOption</a></b>(const QTextOption &amp;<i>option</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setDocumentLayout">setDocumentLayout</a></b>(QAbstractTextDocumentLayout *<i>layout</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#documentMargin-prop">setDocumentMargin</a></b>(qreal <i>margin</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setHtml">setHtml</a></b>(const QString &amp;<i>html</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setIndentWidth">setIndentWidth</a></b>(qreal <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#maximumBlockCount-prop">setMaximumBlockCount</a></b>(int <i>maximum</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setMetaInformation">setMetaInformation</a></b>(MetaInformation <i>info</i>, const QString &amp;<i>string</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#pageSize-prop">setPageSize</a></b>(const QSizeF &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#setPlainText">setPlainText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#textWidth-prop">setTextWidth</a></b>(qreal <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undoRedoEnabled-prop">setUndoRedoEnabled</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#useDesignMetrics-prop">setUseDesignMetrics</a></b>(bool <i>b</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSizeF </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#size-prop">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#textWidth-prop">textWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#toHtml">toHtml</a></b>(const QByteArray &amp;<i>encoding</i> = QByteArray()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#toPlainText">toPlainText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#toRawText">toRawText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undo">undo</a></b>(QTextCursor *<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#useDesignMetrics-prop">useDesignMetrics</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#redo-1">redo</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#modified-prop">setModified</a></b>(bool <i>m</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undo-1">undo</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#baseUrl-prop">baseUrlChanged</a></b>(const QUrl &amp;<i>url</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#blockCountChanged">blockCountChanged</a></b>(int <i>newBlockCount</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#contentsChange">contentsChange</a></b>(int <i>position</i>, int <i>charsRemoved</i>, int <i>charsAdded</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#contentsChanged">contentsChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#cursorPositionChanged">cursorPositionChanged</a></b>(const QTextCursor &amp;<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#documentLayoutChanged">documentLayoutChanged</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#modificationChanged">modificationChanged</a></b>(bool <i>changed</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#redoAvailable">redoAvailable</a></b>(bool <i>available</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undoAvailable">undoAvailable</a></b>(bool <i>available</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#undoCommandAdded">undoCommandAdded</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QTextObject *</td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#createObject">createObject</a></b>(const QTextFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qtextdocument.html#loadResource">loadResource</a></b>(int <i>type</i>, const QUrl &amp;<i>name</i>)</td></tr>
</table></div>
<ul>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QTextDocument-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qtextdocument.html">QTextDocument</a> class holds formatted text.</p>
<p><a href="qtextdocument.html">QTextDocument</a> is a container for structured rich text documents, providing support for styled text and various types of document elements, such as lists, tables, frames, and images. They can be created for use in a <a href="../qtwidgets/qtextedit.html">QTextEdit</a>, or used independently.</p>
<p>Each document element is described by an associated format object. Each format object is treated as a unique object by QTextDocuments, and can be passed to <a href="qtextdocument.html#objectForFormat">objectForFormat</a>() to obtain the document element that it is applied to.</p>
<p>A <a href="qtextdocument.html">QTextDocument</a> can be edited programmatically using a <a href="qtextcursor.html">QTextCursor</a>, and its contents can be examined by traversing the document structure. The entire document structure is stored as a hierarchy of document elements beneath the root frame, found with the <a href="qtextdocument.html#rootFrame">rootFrame</a>() function. Alternatively, if you just want to iterate over the textual contents of the document you can use <a href="qtextdocument.html#begin">begin</a>(), <a href="qtextdocument.html#end">end</a>(), and <a href="qtextdocument.html#findBlock">findBlock</a>() to retrieve text blocks that you can examine and iterate over.</p>
<p>The layout of a document is determined by the <a href="qtextdocument.html#documentLayout">documentLayout</a>(); you can create your own <a href="qabstracttextdocumentlayout.html">QAbstractTextDocumentLayout</a> subclass and set it using <a href="qtextdocument.html#setDocumentLayout">setDocumentLayout</a>() if you want to use your own layout logic. The document's title and other meta-information can be obtained by calling the <a href="qtextdocument.html#metaInformation">metaInformation</a>() function. For documents that are exposed to users through the <a href="../qtwidgets/qtextedit.html">QTextEdit</a> class, the document title is also available via the <a href="../qtwidgets/qtextedit.html#documentTitle-prop">QTextEdit::documentTitle</a>() function.</p>
<p>The <a href="qtextdocument.html#toPlainText">toPlainText</a>() and <a href="qtextdocument.html#toHtml">toHtml</a>() convenience functions allow you to retrieve the contents of the document as plain text and HTML. The document's text can be searched using the <a href="qtextdocument.html#find">find</a>() functions.</p>
<p>Undo/redo of operations performed on the document can be controlled using the <a href="qtextdocument.html#undoRedoEnabled-prop">setUndoRedoEnabled</a>() function. The undo/redo system can be controlled by an editor widget through the <a href="qtextdocument.html#undo-1">undo</a>() and <a href="qtextdocument.html#redo-1">redo</a>() slots; the document also provides <a href="qtextdocument.html#contentsChanged">contentsChanged</a>(), <a href="qtextdocument.html#undoAvailable">undoAvailable</a>(), and <a href="qtextdocument.html#redoAvailable">redoAvailable</a>() signals that inform connected editor widgets about the state of the undo/redo system. The following are the undo/redo operations of a <a href="qtextdocument.html">QTextDocument</a>:</p>
<ul>
<li>Insertion or removal of characters. A sequence of insertions or removals within the same text block are regarded as a single undo/redo operation.</li>
<li>Insertion or removal of text blocks. Sequences of insertion or removals in a single operation (e.g&#x2e;, by selecting and then deleting text) are regarded as a single undo/redo operation.</li>
<li>Text character format changes.</li>
<li>Text block format changes.</li>
<li>Text block group format changes.</li>
</ul>
</div>
<p><b>See also </b><a href="qtextcursor.html">QTextCursor</a>, <a href="../qtwidgets/qtextedit.html">QTextEdit</a>, <a href="richtext.html">Rich Text Processing</a>, and Text Object Example.</p>
<!-- @@@QTextDocument -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$FindFlag$$$FindBackward$$$FindCaseSensitively$$$FindWholeWords -->
<h3 class="flags" id="FindFlag-enum"><a name="FindFlag-enum"></a>enum QTextDocument::<span class="name">FindFlag</span><br/>flags QTextDocument::<span class="name">FindFlags</span></h3>
<p>This enum describes the options available to <a href="qtextdocument.html">QTextDocument</a>'s find function. The options can be OR-ed together from the following list:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTextDocument::FindBackward</code></td><td class="topAlign tblval"><code>0x00001</code></td><td class="topAlign">Search backwards instead of forwards.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::FindCaseSensitively</code></td><td class="topAlign tblval"><code>0x00002</code></td><td class="topAlign">By default find works case insensitive. Specifying this option changes the behaviour to a case sensitive find operation.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::FindWholeWords</code></td><td class="topAlign tblval"><code>0x00004</code></td><td class="topAlign">Makes find match only complete words.</td></tr>
</table></div>
<p>The FindFlags type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;FindFlag&gt;. It stores an OR combination of FindFlag values.</p>
<!-- @@@FindFlag -->
<!-- $$$MetaInformation$$$DocumentTitle$$$DocumentUrl -->
<h3 class="fn" id="MetaInformation-enum"><a name="MetaInformation-enum"></a>enum QTextDocument::<span class="name">MetaInformation</span></h3>
<p>This enum describes the different types of meta information that can be added to a document.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTextDocument::DocumentTitle</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The title of the document.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::DocumentUrl</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The url of the document. The <a href="qtextdocument.html#loadResource">loadResource</a>() function uses this url as the base when loading relative resources.</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#metaInformation">metaInformation</a>() and <a href="qtextdocument.html#setMetaInformation">setMetaInformation</a>().</p>
<!-- @@@MetaInformation -->
<!-- $$$ResourceType$$$HtmlResource$$$ImageResource$$$StyleSheetResource$$$UserResource -->
<h3 class="fn" id="ResourceType-enum"><a name="ResourceType-enum"></a>enum QTextDocument::<span class="name">ResourceType</span></h3>
<p>This enum describes the types of resources that can be loaded by <a href="qtextdocument.html">QTextDocument</a>'s <a href="qtextdocument.html#loadResource">loadResource</a>() function.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTextDocument::HtmlResource</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The resource contains HTML.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::ImageResource</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The resource contains image data. Currently supported data types are QVariant::Pixmap and QVariant::Image. If the corresponding variant is of type QVariant::ByteArray then Qt attempts to load the image using <a href="qimage.html#loadFromData">QImage::loadFromData</a>. QVariant::Icon is currently not supported. The icon needs to be converted to one of the supported types first, for example using <a href="qicon.html#pixmap">QIcon::pixmap</a>.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::StyleSheetResource</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The resource contains CSS.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::UserResource</code></td><td class="topAlign tblval"><code>100</code></td><td class="topAlign">The first available value for user defined resource types.</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#loadResource">loadResource</a>().</p>
<!-- @@@ResourceType -->
<!-- $$$Stacks$$$UndoStack$$$RedoStack$$$UndoAndRedoStacks -->
<h3 class="fn" id="Stacks-enum"><a name="Stacks-enum"></a>enum QTextDocument::<span class="name">Stacks</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTextDocument::UndoStack</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">The undo stack.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::RedoStack</code></td><td class="topAlign tblval"><code>0x02</code></td><td class="topAlign">The redo stack.</td></tr>
<tr><td class="topAlign"><code>QTextDocument::UndoAndRedoStacks</code></td><td class="topAlign tblval"><code>UndoStack | RedoStack</code></td><td class="topAlign">Both the undo and redo stacks.</td></tr>
</table></div>
<!-- @@@Stacks -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$baseUrl-prop$$$baseUrl$$$setBaseUrlconstQUrl&$$$baseUrlChangedconstQUrl& -->
<h3 class="fn" id="baseUrl-prop"><a name="baseUrl-prop"></a><span class="name">baseUrl</span> : <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span></h3>
<p>This property holds the base URL used to resolve relative resource URLs within the document.</p>
<p>Resource URLs are resolved to be within the same directory as the target of the base URL meaning any portion of the path after the last '/' will be ignored.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Base URL</th><th >Relative URL</th><th >Resolved URL</th></tr></thead>
<tr valign="top" class="odd"><td >file:///path/to/content</td><td >images/logo.png</td><td >file:///path/to/images/logo.png</td></tr>
<tr valign="top" class="even"><td >file:///path/to/content/</td><td >images/logo.png</td><td >file:///path/to/content/images/logo.png</td></tr>
<tr valign="top" class="odd"><td >file:///path/to/content/index.html</td><td >images/logo.png</td><td >file:///path/to/content/images/logo.png</td></tr>
<tr valign="top" class="even"><td >file:///path/to/content/images/</td><td >../images/logo.png</td><td >file:///path/to/content/images/logo.png</td></tr>
</table></div>
<p>This property was introduced in  Qt 5.3.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QUrl </td><td class="memItemRight bottomAlign"><span class="name"><b>baseUrl</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBaseUrl</b></span>(const QUrl &amp;<i>url</i>)</td></tr>
</table></div>
<p><b>Notifier signal:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>baseUrlChanged</b></span>(const QUrl &amp;<i>url</i>)</td></tr>
</table></div>
<!-- @@@baseUrl -->
<!-- $$$blockCount-prop$$$blockCount -->
<h3 class="fn" id="blockCount-prop"><a name="blockCount-prop"></a><span class="name">blockCount</span> : const <span class="type">int</span></h3>
<p>Returns the number of text blocks in the document.</p>
<p>The value of this property is undefined in documents with tables or frames.</p>
<p>By default, if defined, this property contains a value of 1.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>blockCount</b></span>() const</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#lineCount">lineCount</a>() and <a href="qtextdocument.html#characterCount">characterCount</a>().</p>
<!-- @@@blockCount -->
<!-- $$$defaultFont-prop$$$defaultFont$$$setDefaultFontconstQFont& -->
<h3 class="fn" id="defaultFont-prop"><a name="defaultFont-prop"></a><span class="name">defaultFont</span> : <span class="type"><a href="qfont.html">QFont</a></span></h3>
<p>This property holds the default font used to display the document's text</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QFont </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qtextdocument.html#defaultFont">defaultFont</a></b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qtextdocument.html#setDefaultFont">setDefaultFont</a></b></span>(const QFont &amp;<i>font</i>)</td></tr>
</table></div>
<!-- @@@defaultFont -->
<!-- $$$defaultStyleSheet-prop$$$defaultStyleSheet$$$setDefaultStyleSheetconstQString& -->
<h3 class="fn" id="defaultStyleSheet-prop"><a name="defaultStyleSheet-prop"></a><span class="name">defaultStyleSheet</span> : <span class="type"><a href="../qtcore/qstring.html">QString</a></span></h3>
<p>The default style sheet is applied to all newly HTML formatted text that is inserted into the document, for example using <a href="qtextdocument.html#setHtml">setHtml</a>() or <a href="qtextcursor.html#insertHtml">QTextCursor::insertHtml</a>().</p>
<p>The style sheet needs to be compliant to CSS 2.1 syntax.</p>
<p><b>Note:</b> Changing the default style sheet does not have any effect to the existing content of the document.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>defaultStyleSheet</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDefaultStyleSheet</b></span>(const QString &amp;<i>sheet</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="richtext-html-subset.html">Supported HTML Subset</a>.</p>
<!-- @@@defaultStyleSheet -->
<!-- $$$defaultTextOption-prop$$$defaultTextOption$$$setDefaultTextOptionconstQTextOption& -->
<h3 class="fn" id="defaultTextOption-prop"><a name="defaultTextOption-prop"></a><span class="name">defaultTextOption</span> : <span class="type"><a href="qtextoption.html">QTextOption</a></span></h3>
<p>This property holds the default text option will be set on all <a href="qtextlayout.html">QTextLayout</a>s in the document.</p>
<p>When <a href="qtextblock.html">QTextBlock</a>s are created, the defaultTextOption is set on their <a href="qtextlayout.html">QTextLayout</a>. This allows setting global properties for the document such as the default word wrap mode.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QTextOption </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qtextdocument.html#defaultTextOption">defaultTextOption</a></b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qtextdocument.html#setDefaultTextOption">setDefaultTextOption</a></b></span>(const QTextOption &amp;<i>option</i>)</td></tr>
</table></div>
<!-- @@@defaultTextOption -->
<!-- $$$documentMargin-prop$$$documentMargin$$$setDocumentMarginqreal -->
<h3 class="fn" id="documentMargin-prop"><a name="documentMargin-prop"></a><span class="name">documentMargin</span> : <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span></h3>
<p>The margin around the document. The default is 4.</p>
<p>This property was introduced in  Qt 4.5.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> qreal </td><td class="memItemRight bottomAlign"><span class="name"><b>documentMargin</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setDocumentMargin</b></span>(qreal <i>margin</i>)</td></tr>
</table></div>
<!-- @@@documentMargin -->
<!-- $$$indentWidth-prop$$$indentWidth$$$setIndentWidthqreal -->
<h3 class="fn" id="indentWidth-prop"><a name="indentWidth-prop"></a><span class="name">indentWidth</span> : <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span></h3>
<p>Returns the width used for text list and text block indenting.</p>
<p>The indent properties of <a href="qtextlistformat.html">QTextListFormat</a> and <a href="qtextblockformat.html">QTextBlockFormat</a> specify multiples of this value. The default indent width is 40.</p>
<p>This property was introduced in  Qt 4.4.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> qreal </td><td class="memItemRight bottomAlign"><span class="name"><b>indentWidth</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b><a href="qtextdocument.html#setIndentWidth">setIndentWidth</a></b></span>(qreal <i>width</i>)</td></tr>
</table></div>
<!-- @@@indentWidth -->
<!-- $$$maximumBlockCount-prop$$$maximumBlockCount$$$setMaximumBlockCountint -->
<h3 class="fn" id="maximumBlockCount-prop"><a name="maximumBlockCount-prop"></a><span class="name">maximumBlockCount</span> : <span class="type">int</span></h3>
<p>Specifies the limit for blocks in the document.</p>
<p>Specifies the maximum number of blocks the document may have. If there are more blocks in the document that specified with this property blocks are removed from the beginning of the document.</p>
<p>A negative or zero value specifies that the document may contain an unlimited amount of blocks.</p>
<p>The default value is 0.</p>
<p>Note that setting this property will apply the limit immediately to the document contents.</p>
<p>Setting this property also disables the undo redo history.</p>
<p>This property is undefined in documents with tables or frames.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>maximumBlockCount</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setMaximumBlockCount</b></span>(int <i>maximum</i>)</td></tr>
</table></div>
<!-- @@@maximumBlockCount -->
<!-- $$$modified-prop$$$isModified$$$setModifiedbool -->
<h3 class="fn" id="modified-prop"><a name="modified-prop"></a><span class="name">modified</span> : <span class="type">bool</span></h3>
<p>This property holds whether the document has been modified by the user</p>
<p>By default, this property is <code>false</code>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isModified</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setModified</b></span>(bool <i>m</i> = true)</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#modificationChanged">modificationChanged</a>().</p>
<!-- @@@modified -->
<!-- $$$pageSize-prop$$$pageSize$$$setPageSizeconstQSizeF& -->
<h3 class="fn" id="pageSize-prop"><a name="pageSize-prop"></a><span class="name">pageSize</span> : <span class="type"><a href="../qtcore/qsizef.html">QSizeF</a></span></h3>
<p>This property holds the page size that should be used for laying out the document</p>
<p>The units are determined by the underlying paint device. The size is measured in logical pixels when painting to the screen, and in points (1/72 inch) when painting to a printer.</p>
<p>By default, for a newly-created, empty document, this property contains an undefined size.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSizeF </td><td class="memItemRight bottomAlign"><span class="name"><b>pageSize</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setPageSize</b></span>(const QSizeF &amp;<i>size</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#modificationChanged">modificationChanged</a>().</p>
<!-- @@@pageSize -->
<!-- $$$size-prop$$$size -->
<h3 class="fn" id="size-prop"><a name="size-prop"></a><span class="name">size</span> : const <span class="type"><a href="../qtcore/qsizef.html">QSizeF</a></span></h3>
<p>Returns the actual size of the document. This is equivalent to <a href="qtextdocument.html#documentLayout">documentLayout</a>()-&gt;documentSize();</p>
<p>The size of the document can be changed either by setting a text width or setting an entire page size.</p>
<p>Note that the width is always &gt;= <a href="qtextdocument.html#pageSize-prop">pageSize</a>().width().</p>
<p>By default, for a newly-created, empty document, this property contains a configuration-dependent size.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QSizeF </td><td class="memItemRight bottomAlign"><span class="name"><b>size</b></span>() const</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#textWidth-prop">setTextWidth</a>(), <a href="qtextdocument.html#pageSize-prop">setPageSize</a>(), and <a href="qtextdocument.html#idealWidth">idealWidth</a>().</p>
<!-- @@@size -->
<!-- $$$textWidth-prop$$$textWidth$$$setTextWidthqreal -->
<h3 class="fn" id="textWidth-prop"><a name="textWidth-prop"></a><span class="name">textWidth</span> : <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span></h3>
<p>The text width specifies the preferred width for text in the document. If the text (or content in general) is wider than the specified with it is broken into multiple lines and grows vertically. If the text cannot be broken into multiple lines to fit into the specified text width it will be larger and the <a href="qtextdocument.html#size-prop">size</a>() and the <a href="qtextdocument.html#idealWidth">idealWidth</a>() property will reflect that.</p>
<p>If the text width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph.</p>
<p>The default value is -1.</p>
<p>Setting the text width will also set the page height to -1, causing the document to grow or shrink vertically in a continuous way. If you want the document layout to break the text into multiple pages then you have to set the <a href="qtextdocument.html#pageSize-prop">pageSize</a> property instead.</p>
<p>This property was introduced in  Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> qreal </td><td class="memItemRight bottomAlign"><span class="name"><b>textWidth</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setTextWidth</b></span>(qreal <i>width</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qtextdocument.html#size-prop">size</a>(), <a href="qtextdocument.html#idealWidth">idealWidth</a>(), and <a href="qtextdocument.html#pageSize-prop">pageSize</a>().</p>
<!-- @@@textWidth -->
<!-- $$$undoRedoEnabled-prop$$$isUndoRedoEnabled$$$setUndoRedoEnabledbool -->
<h3 class="fn" id="undoRedoEnabled-prop"><a name="undoRedoEnabled-prop"></a><span class="name">undoRedoEnabled</span> : <span class="type">bool</span></h3>
<p>This property holds whether undo/redo are enabled for this document</p>
<p>This defaults to true. If disabled, the undo stack is cleared and no items will be added to it.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isUndoRedoEnabled</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setUndoRedoEnabled</b></span>(bool <i>enable</i>)</td></tr>
</table></div>
<!-- @@@undoRedoEnabled -->
<!-- $$$useDesignMetrics-prop$$$useDesignMetrics$$$setUseDesignMetricsbool -->
<h3 class="fn" id="useDesignMetrics-prop"><a name="useDesignMetrics-prop"></a><span class="name">useDesignMetrics</span> : <span class="type">bool</span></h3>
<p>This property holds whether the document uses design metrics of fonts to improve the accuracy of text layout</p>
<p>If this property is set to true, the layout will use design metrics. Otherwise, the metrics of the paint device as set on <a href="qabstracttextdocumentlayout.html#setPaintDevice">QAbstractTextDocumentLayout::setPaintDevice</a>() will be used.</p>
<p>Using design metrics makes a layout have a width that is no longer dependent on hinting and pixel-rounding. This means that WYSIWYG text layout becomes possible because the width scales much more linearly based on paintdevice metrics than it would otherwise.</p>
<p>By default, this property is <code>false</code>.</p>
<p>This property was introduced in  Qt 4.1.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>useDesignMetrics</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setUseDesignMetrics</b></span>(bool <i>b</i>)</td></tr>
</table></div>
<!-- @@@useDesignMetrics -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextDocument[overload1]$$$QTextDocumentQObject* -->
<h3 class="fn" id="QTextDocument"><a name="QTextDocument"></a>QTextDocument::<span class="name">QTextDocument</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs an empty <a href="qtextdocument.html">QTextDocument</a> with the given <i>parent</i>.</p>
<!-- @@@QTextDocument -->
<!-- $$$QTextDocument$$$QTextDocumentconstQString&QObject* -->
<h3 class="fn" id="QTextDocument-1"><a name="QTextDocument-1"></a>QTextDocument::<span class="name">QTextDocument</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qtextdocument.html">QTextDocument</a> containing the plain (unformatted) <i>text</i> specified, and with the given <i>parent</i>.</p>
<!-- @@@QTextDocument -->
<!-- $$$~QTextDocument[overload1]$$$~QTextDocument -->
<h3 class="fn" id="dtor.QTextDocument"><a name="dtor.QTextDocument"></a>QTextDocument::<span class="name">~QTextDocument</span>()</h3>
<p>Destroys the document.</p>
<!-- @@@~QTextDocument -->
<!-- $$$addResource[overload1]$$$addResourceintconstQUrl&constQVariant& -->
<h3 class="fn" id="addResource"><a name="addResource"></a><span class="type">void</span> QTextDocument::<span class="name">addResource</span>(<span class="type">int</span> <i>type</i>, const <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span> &amp;<i>name</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &amp;<i>resource</i>)</h3>
<p>Adds the resource <i>resource</i> to the resource cache, using <i>type</i> and <i>name</i> as identifiers. <i>type</i> should be a value from <a href="qtextdocument.html#ResourceType-enum">QTextDocument::ResourceType</a>.</p>
<p>For example, you can add an image as a resource in order to reference it from within the document:</p>
<pre class="cpp">

      document<span class="operator">-</span><span class="operator">&gt;</span>addResource(<span class="type"><a href="qtextdocument.html#QTextDocument">QTextDocument</a></span><span class="operator">::</span>ImageResource<span class="operator">,</span>
          <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span>(<span class="string">&quot;mydata://image.png&quot;</span>)<span class="operator">,</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>(image));

</pre>
<p>The image can be inserted into the document using the <a href="qtextcursor.html">QTextCursor</a> API:</p>
<pre class="cpp">

      <span class="type"><a href="qtextimageformat.html">QTextImageFormat</a></span> imageFormat;
      imageFormat<span class="operator">.</span>setName(<span class="string">&quot;mydata://image.png&quot;</span>);
      cursor<span class="operator">.</span>insertImage(imageFormat);

</pre>
<p>Alternatively, you can insert images using the HTML <code>img</code> tag:</p>
<pre class="cpp">

      editor<span class="operator">-</span><span class="operator">&gt;</span>append(<span class="string">&quot;&lt;img src=\&quot;mydata://image.png\&quot; /&gt;&quot;</span>);

</pre>
<!-- @@@addResource -->
<!-- $$$adjustSize[overload1]$$$adjustSize -->
<h3 class="fn" id="adjustSize"><a name="adjustSize"></a><span class="type">void</span> QTextDocument::<span class="name">adjustSize</span>()</h3>
<p>Adjusts the document to a reasonable size.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qtextdocument.html#idealWidth">idealWidth</a>(), <a href="qtextdocument.html#textWidth-prop">textWidth</a>, and <a href="qtextdocument.html#size-prop">size</a>.</p>
<!-- @@@adjustSize -->
<!-- $$$allFormats[overload1]$$$allFormats -->
<h3 class="fn" id="allFormats"><a name="allFormats"></a><span class="type"><a href="../qtcore/qvector.html">QVector</a></span>&lt;<span class="type"><a href="qtextformat.html">QTextFormat</a></span>&gt; QTextDocument::<span class="name">allFormats</span>() const</h3>
<p>Returns a vector of text formats for all the formats used in the document.</p>
<!-- @@@allFormats -->
<!-- $$$availableRedoSteps[overload1]$$$availableRedoSteps -->
<h3 class="fn" id="availableRedoSteps"><a name="availableRedoSteps"></a><span class="type">int</span> QTextDocument::<span class="name">availableRedoSteps</span>() const</h3>
<p>Returns the number of available redo steps.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qtextdocument.html#isRedoAvailable">isRedoAvailable</a>().</p>
<!-- @@@availableRedoSteps -->
<!-- $$$availableUndoSteps[overload1]$$$availableUndoSteps -->
<h3 class="fn" id="availableUndoSteps"><a name="availableUndoSteps"></a><span class="type">int</span> QTextDocument::<span class="name">availableUndoSteps</span>() const</h3>
<p>Returns the number of available undo steps.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qtextdocument.html#isUndoAvailable">isUndoAvailable</a>().</p>
<!-- @@@availableUndoSteps -->
<!-- $$$begin[overload1]$$$begin -->
<h3 class="fn" id="begin"><a name="begin"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">begin</span>() const</h3>
<p>Returns the document's first text block.</p>
<p><b>See also </b><a href="qtextdocument.html#firstBlock">firstBlock</a>().</p>
<!-- @@@begin -->
<!-- $$$blockCountChanged[overload1]$$$blockCountChangedint -->
<h3 class="fn" id="blockCountChanged"><a name="blockCountChanged"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">blockCountChanged</span>(<span class="type">int</span> <i>newBlockCount</i>)</h3>
<p>This signal is emitted when the total number of text blocks in the document changes. The value passed in <i>newBlockCount</i> is the new total.</p>
<p>This function was introduced in  Qt 4.3.</p>
<!-- @@@blockCountChanged -->
<!-- $$$characterAt[overload1]$$$characterAtint -->
<h3 class="fn" id="characterAt"><a name="characterAt"></a><span class="type"><a href="../qtcore/qchar.html">QChar</a></span> QTextDocument::<span class="name">characterAt</span>(<span class="type">int</span> <i>pos</i>) const</h3>
<p>Returns the character at position <i>pos</i>, or a null character if the position is out of range.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qtextdocument.html#characterCount">characterCount</a>().</p>
<!-- @@@characterAt -->
<!-- $$$characterCount[overload1]$$$characterCount -->
<h3 class="fn" id="characterCount"><a name="characterCount"></a><span class="type">int</span> QTextDocument::<span class="name">characterCount</span>() const</h3>
<p>Returns the number of characters of this document.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qtextdocument.html#blockCount-prop">blockCount</a>() and <a href="qtextdocument.html#characterAt">characterAt</a>().</p>
<!-- @@@characterCount -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn" id="clear"><a name="clear"></a><code>[virtual] </code><span class="type">void</span> QTextDocument::<span class="name">clear</span>()</h3>
<p>Clears the document.</p>
<!-- @@@clear -->
<!-- $$$clearUndoRedoStacks[overload1]$$$clearUndoRedoStacksStacks -->
<h3 class="fn" id="clearUndoRedoStacks"><a name="clearUndoRedoStacks"></a><span class="type">void</span> QTextDocument::<span class="name">clearUndoRedoStacks</span>(<span class="type"><a href="qtextdocument.html#Stacks-enum">Stacks</a></span> <i>stacksToClear</i> = UndoAndRedoStacks)</h3>
<p>Clears the stacks specified by <i>stacksToClear</i>.</p>
<p>This method clears any commands on the undo stack, the redo stack, or both (the default). If commands are cleared, the appropriate signals are emitted, <a href="qtextdocument.html#undoAvailable">QTextDocument::undoAvailable</a>() or <a href="qtextdocument.html#redoAvailable">QTextDocument::redoAvailable</a>().</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextdocument.html#undoAvailable">QTextDocument::undoAvailable</a>() and <a href="qtextdocument.html#redoAvailable">QTextDocument::redoAvailable</a>().</p>
<!-- @@@clearUndoRedoStacks -->
<!-- $$$clone[overload1]$$$cloneQObject* -->
<h3 class="fn" id="clone"><a name="clone"></a><span class="type"><a href="qtextdocument.html#QTextDocument">QTextDocument</a></span> *QTextDocument::<span class="name">clone</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR) const</h3>
<p>Creates a new <a href="qtextdocument.html">QTextDocument</a> that is a copy of this text document. <i>parent</i> is the parent of the returned text document.</p>
<!-- @@@clone -->
<!-- $$$contentsChange[overload1]$$$contentsChangeintintint -->
<h3 class="fn" id="contentsChange"><a name="contentsChange"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">contentsChange</span>(<span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>charsRemoved</i>, <span class="type">int</span> <i>charsAdded</i>)</h3>
<p>This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.</p>
<p>Information is provided about the <i>position</i> of the character in the document where the change occurred, the number of characters removed (<i>charsRemoved</i>), and the number of characters added (<i>charsAdded</i>).</p>
<p>The signal is emitted before the document's layout manager is notified about the change. This hook allows you to implement syntax highlighting for the document.</p>
<p><b>See also </b><a href="qabstracttextdocumentlayout.html#documentChanged">QAbstractTextDocumentLayout::documentChanged</a>() and <a href="qtextdocument.html#contentsChanged">contentsChanged</a>().</p>
<!-- @@@contentsChange -->
<!-- $$$contentsChanged[overload1]$$$contentsChanged -->
<h3 class="fn" id="contentsChanged"><a name="contentsChanged"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">contentsChanged</span>()</h3>
<p>This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.</p>
<p><b>See also </b><a href="qtextdocument.html#contentsChange">contentsChange</a>().</p>
<!-- @@@contentsChanged -->
<!-- $$$createObject[overload1]$$$createObjectconstQTextFormat& -->
<h3 class="fn" id="createObject"><a name="createObject"></a><code>[virtual protected] </code><span class="type"><a href="qtextobject.html">QTextObject</a></span> *QTextDocument::<span class="name">createObject</span>(const <span class="type"><a href="qtextformat.html">QTextFormat</a></span> &amp;<i>format</i>)</h3>
<p>Creates and returns a new document object (a <a href="qtextobject.html">QTextObject</a>), based on the given <i>format</i>.</p>
<p>QTextObjects will always get created through this method, so you must reimplement it if you use custom text objects inside your document.</p>
<!-- @@@createObject -->
<!-- $$$cursorPositionChanged[overload1]$$$cursorPositionChangedconstQTextCursor& -->
<h3 class="fn" id="cursorPositionChanged"><a name="cursorPositionChanged"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">cursorPositionChanged</span>(const <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> &amp;<i>cursor</i>)</h3>
<p>This signal is emitted whenever the position of a cursor changed due to an editing operation. The cursor that changed is passed in <i>cursor</i>. If the document is used with the <a href="../qtwidgets/qtextedit.html">QTextEdit</a> class and you need a signal when the cursor is moved with the arrow keys you can use the <a href="../qtwidgets/qtextedit.html#cursorPositionChanged">cursorPositionChanged()</a> signal in <a href="../qtwidgets/qtextedit.html">QTextEdit</a>.</p>
<!-- @@@cursorPositionChanged -->
<!-- $$$defaultCursorMoveStyle[overload1]$$$defaultCursorMoveStyle -->
<h3 class="fn" id="defaultCursorMoveStyle"><a name="defaultCursorMoveStyle"></a><span class="type"><a href="../qtcore/qt.html#CursorMoveStyle-enum">Qt::CursorMoveStyle</a></span> QTextDocument::<span class="name">defaultCursorMoveStyle</span>() const</h3>
<p>The default cursor movement style is used by all <a href="qtextcursor.html">QTextCursor</a> objects created from the document. The default is <a href="../qtcore/qt.html#CursorMoveStyle-enum">Qt::LogicalMoveStyle</a>.</p>
<p>This function was introduced in  Qt 4.8.</p>
<p><b>See also </b><a href="qtextdocument.html#setDefaultCursorMoveStyle">setDefaultCursorMoveStyle</a>().</p>
<!-- @@@defaultCursorMoveStyle -->
<!-- $$$defaultFont -->
<h3 class="fn" id="defaultFont"><a name="defaultFont"></a><span class="type"><a href="qfont.html">QFont</a></span> QTextDocument::<span class="name">defaultFont</span>() const</h3>
<p>Returns the default font to be used in the document layout.</p>
<p><b>Note:</b> Getter function for property <a href="qtextdocument.html#defaultFont-prop">defaultFont</a>. </p><p><b>See also </b><a href="qtextdocument.html#setDefaultFont">setDefaultFont</a>().</p>
<!-- @@@defaultFont -->
<!-- $$$defaultTextOption -->
<h3 class="fn" id="defaultTextOption"><a name="defaultTextOption"></a><span class="type"><a href="qtextoption.html">QTextOption</a></span> QTextDocument::<span class="name">defaultTextOption</span>() const</h3>
<p>The default text option is used on all <a href="qtextlayout.html">QTextLayout</a> objects in the document. This allows setting global properties for the document such as the default word wrap mode.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>Note:</b> Getter function for property <a href="qtextdocument.html#defaultTextOption-prop">defaultTextOption</a>. </p><p><b>See also </b><a href="qtextdocument.html#setDefaultTextOption">setDefaultTextOption</a>().</p>
<!-- @@@defaultTextOption -->
<!-- $$$documentLayout[overload1]$$$documentLayout -->
<h3 class="fn" id="documentLayout"><a name="documentLayout"></a><span class="type"><a href="qabstracttextdocumentlayout.html">QAbstractTextDocumentLayout</a></span> *QTextDocument::<span class="name">documentLayout</span>() const</h3>
<p>Returns the document layout for this document.</p>
<p><b>See also </b><a href="qtextdocument.html#setDocumentLayout">setDocumentLayout</a>().</p>
<!-- @@@documentLayout -->
<!-- $$$documentLayoutChanged[overload1]$$$documentLayoutChanged -->
<h3 class="fn" id="documentLayoutChanged"><a name="documentLayoutChanged"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">documentLayoutChanged</span>()</h3>
<p>This signal is emitted when a new document layout is set.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qtextdocument.html#setDocumentLayout">setDocumentLayout</a>().</p>
<!-- @@@documentLayoutChanged -->
<!-- $$$drawContents[overload1]$$$drawContentsQPainter*constQRectF& -->
<h3 class="fn" id="drawContents"><a name="drawContents"></a><span class="type">void</span> QTextDocument::<span class="name">drawContents</span>(<span class="type"><a href="qpainter.html">QPainter</a></span> *<i>p</i>, const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i> = QRectF())</h3>
<p>Draws the content of the document with painter <i>p</i>, clipped to <i>rect</i>. If <i>rect</i> is a null rectangle (default) then the document is painted unclipped.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@drawContents -->
<!-- $$$end[overload1]$$$end -->
<h3 class="fn" id="end"><a name="end"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">end</span>() const</h3>
<p>This function returns a block to test for the end of the document while iterating over it.</p>
<pre class="cpp">

      <span class="keyword">for</span> (<span class="type"><a href="qtextblock.html">QTextBlock</a></span> it <span class="operator">=</span> doc<span class="operator">-</span><span class="operator">&gt;</span>begin(); it <span class="operator">!</span><span class="operator">=</span> doc<span class="operator">-</span><span class="operator">&gt;</span>end(); it <span class="operator">=</span> it<span class="operator">.</span>next())
          cout <span class="operator">&lt;</span><span class="operator">&lt;</span> it<span class="operator">.</span>text()<span class="operator">.</span>toStdString() <span class="operator">&lt;</span><span class="operator">&lt;</span> endl;

</pre>
<p>The block returned is invalid and represents the block after the last block in the document. You can use <a href="qtextdocument.html#lastBlock">lastBlock</a>() to retrieve the last valid block of the document.</p>
<p><b>See also </b><a href="qtextdocument.html#lastBlock">lastBlock</a>().</p>
<!-- @@@end -->
<!-- $$$find[overload1]$$$findconstQString&constQTextCursor&FindFlags -->
<h3 class="fn" id="find"><a name="find"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>subString</i>, const <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> &amp;<i>cursor</i>, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>Finds the next occurrence of the string, <i>subString</i>, in the document. The search starts at the position of the given <i>cursor</i>, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed.</p>
<p>Returns a cursor with the match selected if <i>subString</i> was found; otherwise returns a null cursor.</p>
<p>If the given <i>cursor</i> has a selection, the search begins after the selection; otherwise it begins at the cursor's position.</p>
<p>By default the search is case-sensitive, and can match text anywhere in the document.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstQString&intFindFlags -->
<h3 class="fn" id="find-1"><a name="find-1"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>subString</i>, <span class="type">int</span> <i>position</i> = 0, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>This is an overloaded function.</p>
<p>Finds the next occurrence of the string, <i>subString</i>, in the document. The search starts at the given <i>position</i>, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed.</p>
<p>Returns a cursor with the match selected if <i>subString</i> was found; otherwise returns a null cursor.</p>
<p>If the <i>position</i> is 0 (the default) the search begins from the beginning of the document; otherwise it begins at the specified position.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstQRegExp&intFindFlags -->
<h3 class="fn" id="find-2"><a name="find-2"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qregexp.html">QRegExp</a></span> &amp;<i>expr</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>This is an overloaded function.</p>
<p>Finds the next occurrence that matches the given regular expression, <i>expr</i>, within the same paragraph in the document.</p>
<p>The search starts at the given <i>from</i> position, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed. The <a href="qtextdocument.html#FindFlag-enum">FindCaseSensitively</a> option is ignored for this overload, use <a href="../qtcore/qregexp.html#caseSensitivity">QRegExp::caseSensitivity</a> instead.</p>
<p>Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.</p>
<p>If the <i>from</i> position is 0 (the default) the search begins from the beginning of the document; otherwise it begins at the specified position.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstQRegExp&constQTextCursor&FindFlags -->
<h3 class="fn" id="find-3"><a name="find-3"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qregexp.html">QRegExp</a></span> &amp;<i>expr</i>, const <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> &amp;<i>cursor</i>, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>This is an overloaded function.</p>
<p>Finds the next occurrence that matches the given regular expression, <i>expr</i>, within the same paragraph in the document.</p>
<p>The search starts at the position of the given from <i>cursor</i>, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed. The <a href="qtextdocument.html#FindFlag-enum">FindCaseSensitively</a> option is ignored for this overload, use <a href="../qtcore/qregexp.html#caseSensitivity">QRegExp::caseSensitivity</a> instead.</p>
<p>Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.</p>
<p>If the given <i>cursor</i> has a selection, the search begins after the selection; otherwise it begins at the cursor's position.</p>
<p>By default the search is case-sensitive, and can match text anywhere in the document.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstQRegularExpression&intFindFlags -->
<h3 class="fn" id="find-4"><a name="find-4"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qregularexpression.html">QRegularExpression</a></span> &amp;<i>expr</i>, <span class="type">int</span> <i>from</i> = 0, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>Finds the next occurrence that matches the given regular expression, <i>expr</i>, within the same paragraph in the document.</p>
<p>The search starts at the given <i>from</i> position, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed.</p>
<p>Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.</p>
<p>If the <i>from</i> position is 0 (the default) the search begins from the beginning of the document; otherwise it begins at the specified position.</p>
<p>This function was introduced in  Qt 5.5.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstQRegularExpression&constQTextCursor&FindFlags -->
<h3 class="fn" id="find-5"><a name="find-5"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextDocument::<span class="name">find</span>(const <span class="type"><a href="../qtcore/qregularexpression.html">QRegularExpression</a></span> &amp;<i>expr</i>, const <span class="type"><a href="qtextcursor.html">QTextCursor</a></span> &amp;<i>cursor</i>, <span class="type"><a href="qtextdocument.html#FindFlag-enum">FindFlags</a></span> <i>options</i> = FindFlags()) const</h3>
<p>Finds the next occurrence that matches the given regular expression, <i>expr</i>, within the same paragraph in the document.</p>
<p>The search starts at the position of the given <i>cursor</i>, and proceeds forwards through the document unless specified otherwise in the search options. The <i>options</i> control the type of search performed.</p>
<p>Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.</p>
<p>If the given <i>cursor</i> has a selection, the search begins after the selection; otherwise it begins at the cursor's position.</p>
<p>By default the search is case-sensitive, and can match text anywhere in the document.</p>
<p>This function was introduced in  Qt 5.5.</p>
<!-- @@@find -->
<!-- $$$findBlock[overload1]$$$findBlockint -->
<h3 class="fn" id="findBlock"><a name="findBlock"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">findBlock</span>(<span class="type">int</span> <i>pos</i>) const</h3>
<p>Returns the text block that contains the <i>pos</i>-th character.</p>
<!-- @@@findBlock -->
<!-- $$$findBlockByLineNumber[overload1]$$$findBlockByLineNumberint -->
<h3 class="fn" id="findBlockByLineNumber"><a name="findBlockByLineNumber"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">findBlockByLineNumber</span>(<span class="type">int</span> <i>lineNumber</i>) const</h3>
<p>Returns the text block that contains the specified <i>lineNumber</i>.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qtextblock.html#firstLineNumber">QTextBlock::firstLineNumber</a>().</p>
<!-- @@@findBlockByLineNumber -->
<!-- $$$findBlockByNumber[overload1]$$$findBlockByNumberint -->
<h3 class="fn" id="findBlockByNumber"><a name="findBlockByNumber"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">findBlockByNumber</span>(<span class="type">int</span> <i>blockNumber</i>) const</h3>
<p>Returns the text block with the specified <i>blockNumber</i>.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qtextblock.html#blockNumber">QTextBlock::blockNumber</a>().</p>
<!-- @@@findBlockByNumber -->
<!-- $$$firstBlock[overload1]$$$firstBlock -->
<h3 class="fn" id="firstBlock"><a name="firstBlock"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">firstBlock</span>() const</h3>
<p>Returns the document's first text block.</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@firstBlock -->
<!-- $$$idealWidth[overload1]$$$idealWidth -->
<h3 class="fn" id="idealWidth"><a name="idealWidth"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextDocument::<span class="name">idealWidth</span>() const</h3>
<p>Returns the ideal width of the text document. The ideal width is the actually used width of the document without optional alignments taken into account. It is always &lt;= <a href="qtextdocument.html#size-prop">size</a>().width().</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qtextdocument.html#adjustSize">adjustSize</a>() and <a href="qtextdocument.html#textWidth-prop">textWidth</a>.</p>
<!-- @@@idealWidth -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn" id="isEmpty"><a name="isEmpty"></a><span class="type">bool</span> QTextDocument::<span class="name">isEmpty</span>() const</h3>
<p>Returns <code>true</code> if the document is empty; otherwise returns <code>false</code>.</p>
<!-- @@@isEmpty -->
<!-- $$$isRedoAvailable[overload1]$$$isRedoAvailable -->
<h3 class="fn" id="isRedoAvailable"><a name="isRedoAvailable"></a><span class="type">bool</span> QTextDocument::<span class="name">isRedoAvailable</span>() const</h3>
<p>Returns <code>true</code> if redo is available; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtextdocument.html#isUndoAvailable">isUndoAvailable</a>() and <a href="qtextdocument.html#availableRedoSteps">availableRedoSteps</a>().</p>
<!-- @@@isRedoAvailable -->
<!-- $$$isUndoAvailable[overload1]$$$isUndoAvailable -->
<h3 class="fn" id="isUndoAvailable"><a name="isUndoAvailable"></a><span class="type">bool</span> QTextDocument::<span class="name">isUndoAvailable</span>() const</h3>
<p>Returns <code>true</code> if undo is available; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtextdocument.html#isRedoAvailable">isRedoAvailable</a>() and <a href="qtextdocument.html#availableUndoSteps">availableUndoSteps</a>().</p>
<!-- @@@isUndoAvailable -->
<!-- $$$lastBlock[overload1]$$$lastBlock -->
<h3 class="fn" id="lastBlock"><a name="lastBlock"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextDocument::<span class="name">lastBlock</span>() const</h3>
<p>Returns the document's last (valid) text block.</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@lastBlock -->
<!-- $$$lineCount[overload1]$$$lineCount -->
<h3 class="fn" id="lineCount"><a name="lineCount"></a><span class="type">int</span> QTextDocument::<span class="name">lineCount</span>() const</h3>
<p>Returns the number of lines of this document (if the layout supports this). Otherwise, this is identical to the number of blocks.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qtextdocument.html#blockCount-prop">blockCount</a>() and <a href="qtextdocument.html#characterCount">characterCount</a>().</p>
<!-- @@@lineCount -->
<!-- $$$loadResource[overload1]$$$loadResourceintconstQUrl& -->
<h3 class="fn" id="loadResource"><a name="loadResource"></a><code>[virtual protected] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QTextDocument::<span class="name">loadResource</span>(<span class="type">int</span> <i>type</i>, const <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span> &amp;<i>name</i>)</h3>
<p>Loads data of the specified <i>type</i> from the resource with the given <i>name</i>.</p>
<p>This function is called by the rich text engine to request data that isn't directly stored by <a href="qtextdocument.html">QTextDocument</a>, but still associated with it. For example, images are referenced indirectly by the name attribute of a <a href="qtextimageformat.html">QTextImageFormat</a> object.</p>
<p>When called by Qt, <i>type</i> is one of the values of <a href="qtextdocument.html#ResourceType-enum">QTextDocument::ResourceType</a>.</p>
<p>If the <a href="qtextdocument.html">QTextDocument</a> is a child object of a <a href="../qtcore/qobject.html">QObject</a> that has an invokable loadResource method such as <a href="../qtwidgets/qtextedit.html">QTextEdit</a>, <a href="../qtwidgets/qtextbrowser.html">QTextBrowser</a> or a <a href="qtextdocument.html">QTextDocument</a> itself then the default implementation tries to retrieve the data from the parent.</p>
<!-- @@@loadResource -->
<!-- $$$markContentsDirty[overload1]$$$markContentsDirtyintint -->
<h3 class="fn" id="markContentsDirty"><a name="markContentsDirty"></a><span class="type">void</span> QTextDocument::<span class="name">markContentsDirty</span>(<span class="type">int</span> <i>position</i>, <span class="type">int</span> <i>length</i>)</h3>
<p>Marks the contents specified by the given <i>position</i> and <i>length</i> as &quot;dirty&quot;, informing the document that it needs to be laid out again.</p>
<!-- @@@markContentsDirty -->
<!-- $$$metaInformation[overload1]$$$metaInformationMetaInformation -->
<h3 class="fn" id="metaInformation"><a name="metaInformation"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextDocument::<span class="name">metaInformation</span>(<span class="type"><a href="qtextdocument.html#MetaInformation-enum">MetaInformation</a></span> <i>info</i>) const</h3>
<p>Returns meta information about the document of the type specified by <i>info</i>.</p>
<p><b>See also </b><a href="qtextdocument.html#setMetaInformation">setMetaInformation</a>().</p>
<!-- @@@metaInformation -->
<!-- $$$modificationChanged[overload1]$$$modificationChangedbool -->
<h3 class="fn" id="modificationChanged"><a name="modificationChanged"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">modificationChanged</span>(<span class="type">bool</span> <i>changed</i>)</h3>
<p>This signal is emitted whenever the content of the document changes in a way that affects the modification state. If <i>changed</i> is true, the document has been modified; otherwise it is false.</p>
<p>For example, calling <a href="qtextdocument.html#modified-prop">setModified</a>(false) on a document and then inserting text causes the signal to get emitted. If you undo that operation, causing the document to return to its original unmodified state, the signal will get emitted again.</p>
<!-- @@@modificationChanged -->
<!-- $$$object[overload1]$$$objectint -->
<h3 class="fn" id="object"><a name="object"></a><span class="type"><a href="qtextobject.html">QTextObject</a></span> *QTextDocument::<span class="name">object</span>(<span class="type">int</span> <i>objectIndex</i>) const</h3>
<p>Returns the text object associated with the given <i>objectIndex</i>.</p>
<!-- @@@object -->
<!-- $$$objectForFormat[overload1]$$$objectForFormatconstQTextFormat& -->
<h3 class="fn" id="objectForFormat"><a name="objectForFormat"></a><span class="type"><a href="qtextobject.html">QTextObject</a></span> *QTextDocument::<span class="name">objectForFormat</span>(const <span class="type"><a href="qtextformat.html">QTextFormat</a></span> &amp;<i>f</i>) const</h3>
<p>Returns the text object associated with the format <i>f</i>.</p>
<!-- @@@objectForFormat -->
<!-- $$$pageCount[overload1]$$$pageCount -->
<h3 class="fn" id="pageCount"><a name="pageCount"></a><span class="type">int</span> QTextDocument::<span class="name">pageCount</span>() const</h3>
<p>returns the number of pages in this document.</p>
<!-- @@@pageCount -->
<!-- $$$print[overload1]$$$printQPagedPaintDevice* -->
<h3 class="fn" id="print"><a name="print"></a><span class="type">void</span> QTextDocument::<span class="name">print</span>(<span class="type"><a href="qpagedpaintdevice.html">QPagedPaintDevice</a></span> *<i>printer</i>) const</h3>
<p>Prints the document to the given <i>printer</i>. The QPageablePaintDevice must be set up before being used with this function.</p>
<p>This is only a convenience method to print the whole document to the printer.</p>
<p>If the document is already paginated through a specified height in the <a href="qtextdocument.html#pageSize-prop">pageSize</a>() property it is printed as-is.</p>
<p>If the document is not paginated, like for example a document used in a <a href="../qtwidgets/qtextedit.html">QTextEdit</a>, then a temporary copy of the document is created and the copy is broken into multiple pages according to the size of the paint device's paperRect(). By default a 2 cm margin is set around the document contents. In addition the current page number is printed at the bottom of each page.</p>
<p><b>See also </b><a href="../qtwidgets/qtextedit.html#print">QTextEdit::print</a>().</p>
<!-- @@@print -->
<!-- $$$redo[overload1]$$$redoQTextCursor* -->
<h3 class="fn" id="redo"><a name="redo"></a><span class="type">void</span> QTextDocument::<span class="name">redo</span>(<span class="type"><a href="qtextcursor.html">QTextCursor</a></span> *<i>cursor</i>)</h3>
<p>Redoes the last editing operation on the document if <a href="qtextdocument.html#isRedoAvailable">redo is available</a>.</p>
<p>The provided <i>cursor</i> is positioned at the end of the location where the edition operation was redone.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@redo -->
<!-- $$$redo$$$redo -->
<h3 class="fn" id="redo-1"><a name="redo-1"></a><code>[slot] </code><span class="type">void</span> QTextDocument::<span class="name">redo</span>()</h3>
<p>This is an overloaded function.</p>
<p>Redoes the last editing operation on the document if <a href="qtextdocument.html#isRedoAvailable">redo is available</a>.</p>
<!-- @@@redo -->
<!-- $$$redoAvailable[overload1]$$$redoAvailablebool -->
<h3 class="fn" id="redoAvailable"><a name="redoAvailable"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">redoAvailable</span>(<span class="type">bool</span> <i>available</i>)</h3>
<p>This signal is emitted whenever redo operations become available (<i>available</i> is true) or unavailable (<i>available</i> is false).</p>
<!-- @@@redoAvailable -->
<!-- $$$resource[overload1]$$$resourceintconstQUrl& -->
<h3 class="fn" id="resource"><a name="resource"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QTextDocument::<span class="name">resource</span>(<span class="type">int</span> <i>type</i>, const <span class="type"><a href="../qtcore/qurl.html">QUrl</a></span> &amp;<i>name</i>) const</h3>
<p>Returns data of the specified <i>type</i> from the resource with the given <i>name</i>.</p>
<p>This function is called by the rich text engine to request data that isn't directly stored by <a href="qtextdocument.html">QTextDocument</a>, but still associated with it. For example, images are referenced indirectly by the name attribute of a <a href="qtextimageformat.html">QTextImageFormat</a> object.</p>
<p>Resources are cached internally in the document. If a resource can not be found in the cache, <a href="qtextdocument.html#loadResource">loadResource</a> is called to try to load the resource. <a href="qtextdocument.html#loadResource">loadResource</a> should then use <a href="qtextdocument.html#addResource">addResource</a> to add the resource to the cache.</p>
<p><b>See also </b><a href="qtextdocument.html#ResourceType-enum">QTextDocument::ResourceType</a>.</p>
<!-- @@@resource -->
<!-- $$$revision[overload1]$$$revision -->
<h3 class="fn" id="revision"><a name="revision"></a><span class="type">int</span> QTextDocument::<span class="name">revision</span>() const</h3>
<p>Returns the document's revision (if undo is enabled).</p>
<p>The revision is guaranteed to increase when a document that is not modified is edited.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qtextblock.html#revision">QTextBlock::revision</a>() and <a href="qtextdocument.html#modified-prop">isModified</a>().</p>
<!-- @@@revision -->
<!-- $$$rootFrame[overload1]$$$rootFrame -->
<h3 class="fn" id="rootFrame"><a name="rootFrame"></a><span class="type"><a href="qtextframe.html">QTextFrame</a></span> *QTextDocument::<span class="name">rootFrame</span>() const</h3>
<p>Returns the document's root frame.</p>
<!-- @@@rootFrame -->
<!-- $$$setDefaultCursorMoveStyle[overload1]$$$setDefaultCursorMoveStyleQt::CursorMoveStyle -->
<h3 class="fn" id="setDefaultCursorMoveStyle"><a name="setDefaultCursorMoveStyle"></a><span class="type">void</span> QTextDocument::<span class="name">setDefaultCursorMoveStyle</span>(<span class="type"><a href="../qtcore/qt.html#CursorMoveStyle-enum">Qt::CursorMoveStyle</a></span> <i>style</i>)</h3>
<p>Sets the default cursor movement style to the given <i>style</i>.</p>
<p>This function was introduced in  Qt 4.8.</p>
<p><b>See also </b><a href="qtextdocument.html#defaultCursorMoveStyle">defaultCursorMoveStyle</a>().</p>
<!-- @@@setDefaultCursorMoveStyle -->
<!-- $$$setDefaultFont -->
<h3 class="fn" id="setDefaultFont"><a name="setDefaultFont"></a><span class="type">void</span> QTextDocument::<span class="name">setDefaultFont</span>(const <span class="type"><a href="qfont.html">QFont</a></span> &amp;<i>font</i>)</h3>
<p>Sets the default <i>font</i> to use in the document layout.</p>
<p><b>Note:</b> Setter function for property <a href="qtextdocument.html#defaultFont-prop">defaultFont</a>. </p><p><b>See also </b><a href="qtextdocument.html#defaultFont">defaultFont</a>().</p>
<!-- @@@setDefaultFont -->
<!-- $$$setDefaultTextOption -->
<h3 class="fn" id="setDefaultTextOption"><a name="setDefaultTextOption"></a><span class="type">void</span> QTextDocument::<span class="name">setDefaultTextOption</span>(const <span class="type"><a href="qtextoption.html">QTextOption</a></span> &amp;<i>option</i>)</h3>
<p>Sets the default text option to <i>option</i>.</p>
<p>This function was introduced in  Qt 4.3.</p>
<p><b>Note:</b> Setter function for property <a href="qtextdocument.html#defaultTextOption-prop">defaultTextOption</a>. </p><p><b>See also </b><a href="qtextdocument.html#defaultTextOption">defaultTextOption</a>().</p>
<!-- @@@setDefaultTextOption -->
<!-- $$$setDocumentLayout[overload1]$$$setDocumentLayoutQAbstractTextDocumentLayout* -->
<h3 class="fn" id="setDocumentLayout"><a name="setDocumentLayout"></a><span class="type">void</span> QTextDocument::<span class="name">setDocumentLayout</span>(<span class="type"><a href="qabstracttextdocumentlayout.html">QAbstractTextDocumentLayout</a></span> *<i>layout</i>)</h3>
<p>Sets the document to use the given <i>layout</i>. The previous layout is deleted.</p>
<p><b>See also </b><a href="qtextdocument.html#documentLayoutChanged">documentLayoutChanged</a>().</p>
<!-- @@@setDocumentLayout -->
<!-- $$$setHtml[overload1]$$$setHtmlconstQString& -->
<h3 class="fn" id="setHtml"><a name="setHtml"></a><span class="type">void</span> QTextDocument::<span class="name">setHtml</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>html</i>)</h3>
<p>Replaces the entire contents of the document with the given HTML-formatted text in the <i>html</i> string. The undo/redo history is reset when this function is called.</p>
<p>The HTML formatting is respected as much as possible; for example, &quot;&lt;b&gt;bold&lt;/b&gt; text&quot; will produce text where the first word has a font weight that gives it a bold appearance: &quot;<b>bold</b> text&quot;.</p>
<p><b>Note: </b>It is the responsibility of the caller to make sure that the text is correctly decoded when a <a href="../qtcore/qstring.html">QString</a> containing HTML is created and passed to setHtml().</p><p><b>See also </b><a href="qtextdocument.html#setPlainText">setPlainText</a>() and <a href="richtext-html-subset.html">Supported HTML Subset</a>.</p>
<!-- @@@setHtml -->
<!-- $$$setIndentWidth -->
<h3 class="fn" id="setIndentWidth"><a name="setIndentWidth"></a><span class="type">void</span> QTextDocument::<span class="name">setIndentWidth</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>)</h3>
<p>Sets the <i>width</i> used for text list and text block indenting.</p>
<p>The indent properties of <a href="qtextlistformat.html">QTextListFormat</a> and <a href="qtextblockformat.html">QTextBlockFormat</a> specify multiples of this value. The default indent width is 40 .</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>Note:</b> Setter function for property <a href="qtextdocument.html#indentWidth-prop">indentWidth</a>. </p><p><b>See also </b><a href="qtextdocument.html#indentWidth-prop">indentWidth</a>().</p>
<!-- @@@setIndentWidth -->
<!-- $$$setMetaInformation[overload1]$$$setMetaInformationMetaInformationconstQString& -->
<h3 class="fn" id="setMetaInformation"><a name="setMetaInformation"></a><span class="type">void</span> QTextDocument::<span class="name">setMetaInformation</span>(<span class="type"><a href="qtextdocument.html#MetaInformation-enum">MetaInformation</a></span> <i>info</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>string</i>)</h3>
<p>Sets the document's meta information of the type specified by <i>info</i> to the given <i>string</i>.</p>
<p><b>See also </b><a href="qtextdocument.html#metaInformation">metaInformation</a>().</p>
<!-- @@@setMetaInformation -->
<!-- $$$setPlainText[overload1]$$$setPlainTextconstQString& -->
<h3 class="fn" id="setPlainText"><a name="setPlainText"></a><span class="type">void</span> QTextDocument::<span class="name">setPlainText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Replaces the entire contents of the document with the given plain <i>text</i>. The undo/redo history is reset when this function is called.</p>
<p><b>See also </b><a href="qtextdocument.html#setHtml">setHtml</a>().</p>
<!-- @@@setPlainText -->
<!-- $$$toHtml[overload1]$$$toHtmlconstQByteArray& -->
<h3 class="fn" id="toHtml"><a name="toHtml"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextDocument::<span class="name">toHtml</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>encoding</i> = QByteArray()) const</h3>
<p>Returns a string containing an HTML representation of the document.</p>
<p>The <i>encoding</i> parameter specifies the value for the charset attribute in the html header. For example if 'utf-8' is specified then the beginning of the generated html will look like this:</p>
<pre class="cpp">

  <span class="operator">&lt;</span>html<span class="operator">&gt;</span><span class="operator">&lt;</span>head<span class="operator">&gt;</span><span class="operator">&lt;</span>meta http<span class="operator">-</span>equiv<span class="operator">=</span><span class="string">&quot;Content-Type&quot;</span> content<span class="operator">=</span><span class="string">&quot;text/html; charset=utf-8&quot;</span><span class="operator">&gt;</span><span class="operator">&lt;</span><span class="operator">/</span>head<span class="operator">&gt;</span><span class="operator">&lt;</span>body<span class="operator">&gt;</span><span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

</pre>
<p>If no encoding is specified then no such meta information is generated.</p>
<p>If you later on convert the returned html string into a byte array for transmission over a network or when saving to disk you should specify the encoding you're going to use for the conversion to a byte array here.</p>
<p><b>See also </b><a href="richtext-html-subset.html">Supported HTML Subset</a>.</p>
<!-- @@@toHtml -->
<!-- $$$toPlainText[overload1]$$$toPlainText -->
<h3 class="fn" id="toPlainText"><a name="toPlainText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextDocument::<span class="name">toPlainText</span>() const</h3>
<p>Returns the plain text contained in the document. If you want formatting information use a <a href="qtextcursor.html">QTextCursor</a> instead.</p>
<p>This function returns the same as <a href="qtextdocument.html#toRawText">toRawText</a>(), but will replace some unicode characters with ASCII alternatives. In particular, no-break space (U+00A0) is replaced by a regular space (U+0020), and both paragraph (U+2029) and line (U+2028) separators are replaced by line feed (U+000A). If you need the precise contents of the document, use <a href="qtextdocument.html#toRawText">toRawText</a>() instead.</p>
<p><b>Note: </b>Embedded objects, such as images, are represented by a Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER).</p><p><b>See also </b><a href="qtextdocument.html#toHtml">toHtml</a>().</p>
<!-- @@@toPlainText -->
<!-- $$$toRawText[overload1]$$$toRawText -->
<h3 class="fn" id="toRawText"><a name="toRawText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextDocument::<span class="name">toRawText</span>() const</h3>
<p>Returns the raw text contained in the document without any formatting information. If you want formatting information use a <a href="qtextcursor.html">QTextCursor</a> instead.</p>
<p>This function was introduced in  Qt 5.9.</p>
<p><b>See also </b><a href="qtextdocument.html#toPlainText">toPlainText</a>().</p>
<!-- @@@toRawText -->
<!-- $$$undo[overload1]$$$undoQTextCursor* -->
<h3 class="fn" id="undo"><a name="undo"></a><span class="type">void</span> QTextDocument::<span class="name">undo</span>(<span class="type"><a href="qtextcursor.html">QTextCursor</a></span> *<i>cursor</i>)</h3>
<p>Undoes the last editing operation on the document if undo is available. The provided <i>cursor</i> is positioned at the end of the location where the edition operation was undone.</p>
<p>See the Qt Undo Framework documentation for details.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qtextdocument.html#undoAvailable">undoAvailable</a>() and <a href="qtextdocument.html#undoRedoEnabled-prop">isUndoRedoEnabled</a>().</p>
<!-- @@@undo -->
<!-- $$$undo$$$undo -->
<h3 class="fn" id="undo-1"><a name="undo-1"></a><code>[slot] </code><span class="type">void</span> QTextDocument::<span class="name">undo</span>()</h3>
<p>This is an overloaded function.</p>
<!-- @@@undo -->
<!-- $$$undoAvailable[overload1]$$$undoAvailablebool -->
<h3 class="fn" id="undoAvailable"><a name="undoAvailable"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">undoAvailable</span>(<span class="type">bool</span> <i>available</i>)</h3>
<p>This signal is emitted whenever undo operations become available (<i>available</i> is true) or unavailable (<i>available</i> is false).</p>
<p>See the Qt Undo Framework documentation for details.</p>
<p><b>See also </b><a href="qtextdocument.html#undo-1">undo</a>() and <a href="qtextdocument.html#undoRedoEnabled-prop">isUndoRedoEnabled</a>().</p>
<!-- @@@undoAvailable -->
<!-- $$$undoCommandAdded[overload1]$$$undoCommandAdded -->
<h3 class="fn" id="undoCommandAdded"><a name="undoCommandAdded"></a><code>[signal] </code><span class="type">void</span> QTextDocument::<span class="name">undoCommandAdded</span>()</h3>
<p>This signal is emitted every time a new level of undo is added to the <a href="qtextdocument.html">QTextDocument</a>.</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@undoCommandAdded -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    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.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>