Sophie

Sophie

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

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" />
<!-- qtextobject.cpp -->
  <title>QTextFragment 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 >QTextFragment</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-functions">Public 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">QTextFragment Class</h1>
<!-- $$$QTextFragment-brief -->
<p>The <a href="qtextfragment.html">QTextFragment</a> class holds a piece of text in a <a href="qtextdocument.html">QTextDocument</a> with a single <a href="qtextcharformat.html">QTextCharFormat</a>. <a href="#details">More...</a></p>
<!-- @@@QTextFragment -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTextFragment&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr></table></div><ul>
<li><a href="qtextfragment-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-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="qtextfragment.html#QTextFragment">QTextFragment</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#QTextFragment-2">QTextFragment</a></b>(const QTextFragment &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCharFormat </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#charFormat">charFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#charFormatIndex">charFormatIndex</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#contains">contains</a></b>(int <i>position</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGlyphRun&gt; </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#glyphRuns">glyphRuns</a></b>(int <i>pos</i> = -1, int <i>len</i> = -1) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#length">length</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#position">position</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#text">text</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#operator-not-eq">operator!=</a></b>(const QTextFragment &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#operator-lt">operator&lt;</a></b>(const QTextFragment &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextFragment &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#operator-eq">operator=</a></b>(const QTextFragment &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextfragment.html#operator-eq-eq">operator==</a></b>(const QTextFragment &amp;<i>other</i>) const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTextFragment-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qtextfragment.html">QTextFragment</a> class holds a piece of text in a <a href="qtextdocument.html">QTextDocument</a> with a single <a href="qtextcharformat.html">QTextCharFormat</a>.</p>
<p>A text fragment describes a piece of text that is stored with a single character format. Text in which the character format changes can be represented by sequences of text fragments with different formats.</p>
<p>If the user edits the text in a fragment and introduces a different character format, the fragment's text will be split at each point where the format changes, and new fragments will be created. For example, changing the style of some text in the middle of a sentence will cause the fragment to be broken into three separate fragments: the first and third with the same format as before, and the second with the new style. The first fragment will contain the text from the beginning of the sentence, the second will contain the text from the middle, and the third takes the text from the end of the sentence.</p>
<p class="centerAlign"><img src="images/qtextfragment-split.png" alt="" /></p><p>A fragment's text and character format can be obtained with the <a href="qtextfragment.html#text">text</a>() and <a href="qtextfragment.html#charFormat">charFormat</a>() functions. The <a href="qtextfragment.html#length">length</a>() function gives the length of the text in the fragment. <a href="qtextfragment.html#position">position</a>() gives the position in the document of the start of the fragment. To determine whether the fragment contains a particular position within the document, use the <a href="qtextfragment.html#contains">contains</a>() function.</p>
</div>
<p><b>See also </b><a href="qtextdocument.html">QTextDocument</a> and <a href="richtext-structure.html">Rich Text Document Structure</a>.</p>
<!-- @@@QTextFragment -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextFragment[overload1]$$$QTextFragment -->
<h3 class="fn" id="QTextFragment"><a name="QTextFragment"></a>QTextFragment::<span class="name">QTextFragment</span>()</h3>
<p>Creates a new empty text fragment.</p>
<!-- @@@QTextFragment -->
<!-- $$$QTextFragment$$$QTextFragmentconstQTextFragment& -->
<h3 class="fn" id="QTextFragment-2"><a name="QTextFragment-2"></a>QTextFragment::<span class="name">QTextFragment</span>(const <span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;<i>other</i>)</h3>
<p>Copies the content (text and format) of the <i>other</i> text fragment to this text fragment.</p>
<!-- @@@QTextFragment -->
<!-- $$$charFormat[overload1]$$$charFormat -->
<h3 class="fn" id="charFormat"><a name="charFormat"></a><span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> QTextFragment::<span class="name">charFormat</span>() const</h3>
<p>Returns the text fragment's character format.</p>
<p><b>See also </b><a href="qtextfragment.html#text">text</a>().</p>
<!-- @@@charFormat -->
<!-- $$$charFormatIndex[overload1]$$$charFormatIndex -->
<h3 class="fn" id="charFormatIndex"><a name="charFormatIndex"></a><span class="type">int</span> QTextFragment::<span class="name">charFormatIndex</span>() const</h3>
<p>Returns an index into the document's internal list of character formats for the text fragment's character format.</p>
<p><b>See also </b><a href="qtextdocument.html#allFormats">QTextDocument::allFormats</a>().</p>
<!-- @@@charFormatIndex -->
<!-- $$$contains[overload1]$$$containsint -->
<h3 class="fn" id="contains"><a name="contains"></a><span class="type">bool</span> QTextFragment::<span class="name">contains</span>(<span class="type">int</span> <i>position</i>) const</h3>
<p>Returns <code>true</code> if the text fragment contains the text at the given <i>position</i> in the document; otherwise returns <code>false</code>.</p>
<!-- @@@contains -->
<!-- $$$glyphRuns[overload1]$$$glyphRunsintint -->
<h3 class="fn" id="glyphRuns"><a name="glyphRuns"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qglyphrun.html">QGlyphRun</a></span>&gt; QTextFragment::<span class="name">glyphRuns</span>(<span class="type">int</span> <i>pos</i> = -1, <span class="type">int</span> <i>len</i> = -1) const</h3>
<p>Returns the glyphs corresponding to <i>len</i> characters of this text fragment starting at position <i>pos</i>. The positions of the glyphs are relative to the position of the <a href="qtextblock.html">QTextBlock</a>'s layout.</p>
<p>If <i>pos</i> is less than zero, it will default to the start of the <a href="qtextfragment.html">QTextFragment</a>. If <i>len</i> is less than zero, it will default to the length of the fragment.</p>
<p><b>See also </b><a href="qglyphrun.html">QGlyphRun</a>, <a href="qtextblock.html#layout">QTextBlock::layout</a>(), <a href="qtextlayout.html#position">QTextLayout::position</a>(), and <a href="qpainter.html#drawGlyphRun">QPainter::drawGlyphRun</a>().</p>
<!-- @@@glyphRuns -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QTextFragment::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if this is a valid text fragment (i.e&#x2e; has a valid position in a document); otherwise returns <code>false</code>.</p>
<!-- @@@isValid -->
<!-- $$$length[overload1]$$$length -->
<h3 class="fn" id="length"><a name="length"></a><span class="type">int</span> QTextFragment::<span class="name">length</span>() const</h3>
<p>Returns the number of characters in the text fragment.</p>
<p><b>See also </b><a href="qtextfragment.html#text">text</a>().</p>
<!-- @@@length -->
<!-- $$$position[overload1]$$$position -->
<h3 class="fn" id="position"><a name="position"></a><span class="type">int</span> QTextFragment::<span class="name">position</span>() const</h3>
<p>Returns the position of this text fragment in the document.</p>
<!-- @@@position -->
<!-- $$$text[overload1]$$$text -->
<h3 class="fn" id="text"><a name="text"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextFragment::<span class="name">text</span>() const</h3>
<p>Returns the text fragment's as plain text.</p>
<p><b>See also </b><a href="qtextfragment.html#length">length</a>() and <a href="qtextfragment.html#charFormat">charFormat</a>().</p>
<!-- @@@text -->
<!-- $$$operator!=[overload1]$$$operator!=constQTextFragment& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QTextFragment::<span class="name">operator!=</span>(const <span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if this text fragment is different (at a different position) from the <i>other</i> text fragment; otherwise returns false.</p>
<!-- @@@operator!= -->
<!-- $$$operator<[overload1]$$$operator<constQTextFragment& -->
<h3 class="fn" id="operator-lt"><a name="operator-lt"></a><span class="type">bool</span> QTextFragment::<span class="name">operator&lt;</span>(const <span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if this text fragment appears earlier in the document than the <i>other</i> text fragment; otherwise returns <code>false</code>.</p>
<!-- @@@operator< -->
<!-- $$$operator=[overload1]$$$operator=constQTextFragment& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;QTextFragment::<span class="name">operator=</span>(const <span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;<i>other</i>)</h3>
<p>Assigns the content (text and format) of the <i>other</i> text fragment to this text fragment.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQTextFragment& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QTextFragment::<span class="name">operator==</span>(const <span class="type"><a href="qtextfragment.html#QTextFragment">QTextFragment</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if this text fragment is the same (at the same position) as the <i>other</i> text fragment; otherwise returns <code>false</code>.</p>
<!-- @@@operator== -->
</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>