<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qtextobject.cpp --> <title>QTextFrame Class | Qt GUI 5.12.6</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.12</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTextFrame</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.12.6 Reference Documentation</a></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="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QTextFrame Class</h1> <!-- $$$QTextFrame-brief --> <p>The <a href="qtextframe.html">QTextFrame</a> class represents a frame in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p> <!-- @@@QTextFrame --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QTextFrame></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="qtextobject.html">QTextObject</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qtexttable.html">QTextTable</a></p> </td></tr></table></div><ul> <li><a href="qtextframe-members.html">List of all members, including inherited members</a></li> <li><a href="qtextframe-obsolete.html">Obsolete 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"> class </td><td class="memItemRight bottomAlign"><b><a href="qtextframe-iterator.html">iterator</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#Iterator-typedef">Iterator</a></b></td></tr> </table></div> <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="qtextframe.html#QTextFrame">QTextFrame</a></b>(QTextDocument *<i>document</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#dtor.QTextFrame">~QTextFrame</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextFrame::iterator </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#begin">begin</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QTextFrame *> </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#childFrames">childFrames</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextFrame::iterator </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#end">end</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#firstPosition">firstPosition</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextFrameFormat </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#frameFormat">frameFormat</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextCursor </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#lastPosition">lastPosition</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QTextFrame *</td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#parentFrame">parentFrame</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#setFrameFormat">setFrameFormat</a></b>(const QTextFrameFormat &<i>format</i>)</td></tr> </table></div> <ul> <li class="fn">4 public functions inherited from <a href="qtextobject.html#public-functions">QTextObject</a></li> <li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qtextframe.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li> <li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li> <li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li> <li class="fn">1 protected function inherited from <a href="qtextobject.html#protected-functions">QTextObject</a></li> <li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QTextFrame-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qtextframe.html">QTextFrame</a> class represents a frame in a <a href="qtextdocument.html">QTextDocument</a>.</p> <p>Text frames provide structure for the text in a document. They are used as generic containers for other document elements. Frames are usually created by using <a href="qtextcursor.html#insertFrame">QTextCursor::insertFrame</a>().</p> <p>Frames can be used to create hierarchical structures in rich text documents. Each document has a root frame (<a href="qtextdocument.html#rootFrame">QTextDocument::rootFrame</a>()), and each frame beneath the root frame has a parent frame and a (possibly empty) list of child frames. The parent frame can be found with <a href="qtextframe.html#parentFrame">parentFrame</a>(), and the <a href="qtextframe.html#childFrames">childFrames</a>() function provides a list of child frames.</p> <p>Each frame contains at least one text block to enable text cursors to insert new document elements within. As a result, the <a href="qtextframe-iterator.html">QTextFrame::iterator</a> class is used to traverse both the blocks and child frames within a given frame. The first and last child elements in the frame can be found with <a href="qtextframe.html#begin">begin</a>() and <a href="qtextframe.html#end">end</a>().</p> <p>A frame also has a format (specified using <a href="qtextframeformat.html">QTextFrameFormat</a>) which can be set with <a href="qtextobject.html#setFormat">setFormat</a>() and read with <a href="qtextobject.html#format">format</a>().</p> <p>Text cursors can be obtained that point to the first and last valid cursor positions within a frame; use the <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>() and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>() functions for this. The frame's extent in the document can be found with <a href="qtextframe.html#firstPosition">firstPosition</a>() and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p> <p>You can iterate over a frame's contents using the <a href="qtextframe-iterator.html">QTextFrame::iterator</a> class: this provides read-only access to its internal list of text blocks and child frames.</p> </div> <p><b>See also </b><a href="qtextcursor.html">QTextCursor</a> and <a href="qtextdocument.html">QTextDocument</a>.</p> <!-- @@@QTextFrame --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Iterator --> <h3 class="fn" id="Iterator-typedef"><a name="Iterator-typedef"></a>typedef QTextFrame::<span class="name">Iterator</span></h3> <p>Qt-style synonym for <a href="qtextframe-iterator.html">QTextFrame::iterator</a>.</p> <!-- @@@Iterator --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QTextFrame[overload1]$$$QTextFrameQTextDocument* --> <h3 class="fn" id="QTextFrame"><a name="QTextFrame"></a>QTextFrame::<span class="name">QTextFrame</span>(<span class="type"><a href="qtextdocument.html">QTextDocument</a></span> *<i>document</i>)</h3> <p>Creates a new empty frame for the text <i>document</i>.</p> <!-- @@@QTextFrame --> <!-- $$$~QTextFrame[overload1]$$$~QTextFrame --> <h3 class="fn" id="dtor.QTextFrame"><a name="dtor.QTextFrame"></a><code>[virtual] </code>QTextFrame::<span class="name">~QTextFrame</span>()</h3> <p>Destroys the text frame.</p> <p><b>Warning:</b> Text frames are owned by the document, so you should never destroy them yourself. In order to remove a frame from its document, remove its contents using a <code>QTextCursor</code>.</p> <!-- @@@~QTextFrame --> <!-- $$$begin[overload1]$$$begin --> <h3 class="fn" id="begin"><a name="begin"></a><span class="type"><a href="qtextframe-iterator.html">QTextFrame::iterator</a></span> QTextFrame::<span class="name">begin</span>() const</h3> <p>Returns an iterator pointing to the first document element inside the frame. Please see the document <a href="../qtcore/containers.html#stl-style-iterators">STL-style-Iterators</a> for more information.</p> <p><b>See also </b><a href="qtextframe.html#end">end</a>().</p> <!-- @@@begin --> <!-- $$$childFrames[overload1]$$$childFrames --> <h3 class="fn" id="childFrames"><a name="childFrames"></a><span class="type">QList</span><<span class="type"><a href="qtextframe.html#QTextFrame">QTextFrame</a></span> *> QTextFrame::<span class="name">childFrames</span>() const</h3> <p>Returns a (possibly empty) list of the frame's child frames.</p> <p><b>See also </b><a href="qtextframe.html#parentFrame">parentFrame</a>().</p> <!-- @@@childFrames --> <!-- $$$end[overload1]$$$end --> <h3 class="fn" id="end"><a name="end"></a><span class="type"><a href="qtextframe-iterator.html">QTextFrame::iterator</a></span> QTextFrame::<span class="name">end</span>() const</h3> <p>Returns an iterator pointing to the position past the last document element inside the frame. Please see the document <a href="../qtcore/containers.html#stl-style-iterators">STL-Style Iterators</a> for more information.</p> <p><b>See also </b><a href="qtextframe.html#begin">begin</a>().</p> <!-- @@@end --> <!-- $$$firstCursorPosition[overload1]$$$firstCursorPosition --> <h3 class="fn" id="firstCursorPosition"><a name="firstCursorPosition"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextFrame::<span class="name">firstCursorPosition</span>() const</h3> <p>Returns the first cursor position inside the frame.</p> <p><b>See also </b><a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>(), <a href="qtextframe.html#firstPosition">firstPosition</a>(), and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p> <!-- @@@firstCursorPosition --> <!-- $$$firstPosition[overload1]$$$firstPosition --> <h3 class="fn" id="firstPosition"><a name="firstPosition"></a><span class="type">int</span> QTextFrame::<span class="name">firstPosition</span>() const</h3> <p>Returns the first document position inside the frame.</p> <p><b>See also </b><a href="qtextframe.html#lastPosition">lastPosition</a>(), <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>().</p> <!-- @@@firstPosition --> <!-- $$$frameFormat[overload1]$$$frameFormat --> <h3 class="fn" id="frameFormat"><a name="frameFormat"></a><span class="type"><a href="qtextframeformat.html">QTextFrameFormat</a></span> QTextFrame::<span class="name">frameFormat</span>() const</h3> <p>Returns the frame's format.</p> <p><b>See also </b><a href="qtextframe.html#setFrameFormat">setFrameFormat</a>().</p> <!-- @@@frameFormat --> <!-- $$$lastCursorPosition[overload1]$$$lastCursorPosition --> <h3 class="fn" id="lastCursorPosition"><a name="lastCursorPosition"></a><span class="type"><a href="qtextcursor.html">QTextCursor</a></span> QTextFrame::<span class="name">lastCursorPosition</span>() const</h3> <p>Returns the last cursor position inside the frame.</p> <p><b>See also </b><a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), <a href="qtextframe.html#firstPosition">firstPosition</a>(), and <a href="qtextframe.html#lastPosition">lastPosition</a>().</p> <!-- @@@lastCursorPosition --> <!-- $$$lastPosition[overload1]$$$lastPosition --> <h3 class="fn" id="lastPosition"><a name="lastPosition"></a><span class="type">int</span> QTextFrame::<span class="name">lastPosition</span>() const</h3> <p>Returns the last document position inside the frame.</p> <p><b>See also </b><a href="qtextframe.html#firstPosition">firstPosition</a>(), <a href="qtextframe.html#firstCursorPosition">firstCursorPosition</a>(), and <a href="qtextframe.html#lastCursorPosition">lastCursorPosition</a>().</p> <!-- @@@lastPosition --> <!-- $$$parentFrame[overload1]$$$parentFrame --> <h3 class="fn" id="parentFrame"><a name="parentFrame"></a><span class="type"><a href="qtextframe.html#QTextFrame">QTextFrame</a></span> *QTextFrame::<span class="name">parentFrame</span>() const</h3> <p>Returns the frame's parent frame. If the frame is the root frame of a document, this will return 0.</p> <p><b>See also </b><a href="qtextframe.html#childFrames">childFrames</a>() and <a href="qtextdocument.html#rootFrame">QTextDocument::rootFrame</a>().</p> <!-- @@@parentFrame --> <!-- $$$setFrameFormat[overload1]$$$setFrameFormatconstQTextFrameFormat& --> <h3 class="fn" id="setFrameFormat"><a name="setFrameFormat"></a><span class="type">void</span> QTextFrame::<span class="name">setFrameFormat</span>(const <span class="type"><a href="qtextframeformat.html">QTextFrameFormat</a></span> &<i>format</i>)</h3> <p>Sets the frame's <i>format</i>.</p> <p><b>See also </b><a href="qtextframe.html#frameFormat">frameFormat</a>().</p> <!-- @@@setFrameFormat --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 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>