Sophie

Sophie

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

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" />
<!-- qtextcursor.cpp -->
  <title>QTextCursor 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 >QTextCursor</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="#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">QTextCursor Class</h1>
<!-- $$$QTextCursor-brief -->
<p>The <a href="qtextcursor.html">QTextCursor</a> class offers an API to access and modify QTextDocuments. <a href="#details">More...</a></p>
<!-- @@@QTextCursor -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTextCursor&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="qtextcursor-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="qtextcursor.html#MoveMode-enum">MoveMode</a></b> { MoveAnchor, KeepAnchor }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#MoveOperation-enum">MoveOperation</a></b> { NoMove, Start, StartOfLine, StartOfBlock, ..., PreviousRow }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#SelectionType-enum">SelectionType</a></b> { Document, BlockUnderCursor, LineUnderCursor, WordUnderCursor }</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="qtextcursor.html#QTextCursor">QTextCursor</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#QTextCursor-1">QTextCursor</a></b>(QTextDocument *<i>document</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#QTextCursor-4">QTextCursor</a></b>(QTextFrame *<i>frame</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#QTextCursor-5">QTextCursor</a></b>(const QTextBlock &amp;<i>block</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#QTextCursor-6">QTextCursor</a></b>(const QTextCursor &amp;<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#dtor.QTextCursor">~QTextCursor</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#anchor">anchor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#atBlockEnd">atBlockEnd</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#atBlockStart">atBlockStart</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#atEnd">atEnd</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#atStart">atStart</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#beginEditBlock">beginEditBlock</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlock </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#block">block</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCharFormat </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#blockCharFormat">blockCharFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextBlockFormat </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#blockFormat">blockFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#blockNumber">blockNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCharFormat </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#charFormat">charFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#clearSelection">clearSelection</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#columnNumber">columnNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextList *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#createList">createList</a></b>(const QTextListFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextList *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#createList-1">createList</a></b>(QTextListFormat::Style <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextFrame *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#currentFrame">currentFrame</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextList *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#currentList">currentList</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextTable *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#currentTable">currentTable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#deleteChar">deleteChar</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#deletePreviousChar">deletePreviousChar</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocument *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#document">document</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#endEditBlock">endEditBlock</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#hasComplexSelection">hasComplexSelection</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#hasSelection">hasSelection</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertBlock">insertBlock</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertBlock-1">insertBlock</a></b>(const QTextBlockFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertBlock-2">insertBlock</a></b>(const QTextBlockFormat &amp;<i>format</i>, const QTextCharFormat &amp;<i>charFormat</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertFragment">insertFragment</a></b>(const QTextDocumentFragment &amp;<i>fragment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextFrame *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertFrame">insertFrame</a></b>(const QTextFrameFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertHtml">insertHtml</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="qtextcursor.html#insertImage">insertImage</a></b>(const QTextImageFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertImage-1">insertImage</a></b>(const QTextImageFormat &amp;<i>format</i>, QTextFrameFormat::Position <i>alignment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertImage-2">insertImage</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertImage-3">insertImage</a></b>(const QImage &amp;<i>image</i>, const QString &amp;<i>name</i> = QString())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextList *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertList">insertList</a></b>(const QTextListFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextList *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertList-1">insertList</a></b>(QTextListFormat::Style <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextTable *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertTable">insertTable</a></b>(int <i>rows</i>, int <i>columns</i>, const QTextTableFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextTable *</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertTable-1">insertTable</a></b>(int <i>rows</i>, int <i>columns</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#insertText">insertText</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="qtextcursor.html#insertText-1">insertText</a></b>(const QString &amp;<i>text</i>, const QTextCharFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#isCopyOf">isCopyOf</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#isNull">isNull</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#joinPreviousEditBlock">joinPreviousEditBlock</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#keepPositionOnInsert">keepPositionOnInsert</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#mergeBlockCharFormat">mergeBlockCharFormat</a></b>(const QTextCharFormat &amp;<i>modifier</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#mergeBlockFormat">mergeBlockFormat</a></b>(const QTextBlockFormat &amp;<i>modifier</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#mergeCharFormat">mergeCharFormat</a></b>(const QTextCharFormat &amp;<i>modifier</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#movePosition">movePosition</a></b>(MoveOperation <i>operation</i>, MoveMode <i>mode</i> = MoveAnchor, int <i>n</i> = 1)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#position">position</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#positionInBlock">positionInBlock</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#removeSelectedText">removeSelectedText</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#select">select</a></b>(SelectionType <i>selection</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#selectedTableCells">selectedTableCells</a></b>(int *<i>firstRow</i>, int *<i>numRows</i>, int *<i>firstColumn</i>, int *<i>numColumns</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#selectedText">selectedText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextDocumentFragment </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#selection">selection</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#selectionEnd">selectionEnd</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#selectionStart">selectionStart</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setBlockCharFormat">setBlockCharFormat</a></b>(const QTextCharFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a></b>(const QTextBlockFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setCharFormat">setCharFormat</a></b>(const QTextCharFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setKeepPositionOnInsert">setKeepPositionOnInsert</a></b>(bool <i>b</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setPosition">setPosition</a></b>(int <i>pos</i>, MoveMode <i>m</i> = MoveAnchor)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setVerticalMovementX">setVerticalMovementX</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#setVisualNavigation">setVisualNavigation</a></b>(bool <i>b</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#swap">swap</a></b>(QTextCursor &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#verticalMovementX">verticalMovementX</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#visualNavigation">visualNavigation</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-not-eq">operator!=</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-lt">operator&lt;</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-lt-eq">operator&lt;=</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-eq">operator=</a></b>(QTextCursor &amp;&amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextCursor &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-eq-1">operator=</a></b>(const QTextCursor &amp;<i>cursor</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-eq-eq">operator==</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-gt">operator&gt;</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextcursor.html#operator-gt-eq">operator&gt;=</a></b>(const QTextCursor &amp;<i>other</i>) const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTextCursor-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qtextcursor.html">QTextCursor</a> class offers an API to access and modify QTextDocuments.</p>
<p>Text cursors are objects that are used to access and modify the contents and underlying structure of text documents via a programming interface that mimics the behavior of a cursor in a text editor. <a href="qtextcursor.html">QTextCursor</a> contains information about both the cursor's position within a <a href="qtextdocument.html">QTextDocument</a> and any selection that it has made.</p>
<p><a href="qtextcursor.html">QTextCursor</a> is modeled on the way a text cursor behaves in a text editor, providing a programmatic means of performing standard actions through the user interface. A document can be thought of as a single string of characters. The cursor's current <a href="qtextcursor.html#position">position</a>() then is always either <i>between</i> two consecutive characters in the string, or else <i>before</i> the very first character or <i>after</i> the very last character in the string. Documents can also contain tables, lists, images, and other objects in addition to text but, from the developer's point of view, the document can be treated as one long string. Some portions of that string can be considered to lie within particular blocks (e.g&#x2e; paragraphs), or within a table's cell, or a list's item, or other structural elements. When we refer to &quot;current character&quot; we mean the character immediately <i>before</i> the cursor <a href="qtextcursor.html#position">position</a>() in the document. Similarly, the &quot;current block&quot; is the block that contains the cursor <a href="qtextcursor.html#position">position</a>().</p>
<p>A <a href="qtextcursor.html">QTextCursor</a> also has an <a href="qtextcursor.html#anchor">anchor</a>() position. The text that is between the <a href="qtextcursor.html#anchor">anchor</a>() and the <a href="qtextcursor.html#position">position</a>() is the selection. If <a href="qtextcursor.html#anchor">anchor</a>() == <a href="qtextcursor.html#position">position</a>() there is no selection.</p>
<p>The cursor position can be changed programmatically using <a href="qtextcursor.html#setPosition">setPosition</a>() and <a href="qtextcursor.html#movePosition">movePosition</a>(); the latter can also be used to select text. For selections see <a href="qtextcursor.html#selectionStart">selectionStart</a>(), <a href="qtextcursor.html#selectionEnd">selectionEnd</a>(), <a href="qtextcursor.html#hasSelection">hasSelection</a>(), <a href="qtextcursor.html#clearSelection">clearSelection</a>(), and <a href="qtextcursor.html#removeSelectedText">removeSelectedText</a>().</p>
<p>If the <a href="qtextcursor.html#position">position</a>() is at the start of a block, <a href="qtextcursor.html#atBlockStart">atBlockStart</a>() returns <code>true</code>; and if it is at the end of a block, <a href="qtextcursor.html#atBlockEnd">atBlockEnd</a>() returns true. The format of the current character is returned by <a href="qtextcursor.html#charFormat">charFormat</a>(), and the format of the current block is returned by <a href="qtextcursor.html#blockFormat">blockFormat</a>().</p>
<p>Formatting can be applied to the current text document using the <a href="qtextcursor.html#setCharFormat">setCharFormat</a>(), <a href="qtextcursor.html#mergeCharFormat">mergeCharFormat</a>(), <a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>() and <a href="qtextcursor.html#mergeBlockFormat">mergeBlockFormat</a>() functions. The 'set' functions will replace the cursor's current character or block format, while the 'merge' functions add the given format properties to the cursor's current format. If the cursor has a selection, the given format is applied to the current selection. Note that when only a part of a block is selected, the block format is applied to the entire block. The text at the current character position can be turned into a list using <a href="qtextcursor.html#createList">createList</a>().</p>
<p>Deletions can be achieved using <a href="qtextcursor.html#deleteChar">deleteChar</a>(), <a href="qtextcursor.html#deletePreviousChar">deletePreviousChar</a>(), and <a href="qtextcursor.html#removeSelectedText">removeSelectedText</a>().</p>
<p>Text strings can be inserted into the document with the <a href="qtextcursor.html#insertText">insertText</a>() function, blocks (representing new paragraphs) can be inserted with <a href="qtextcursor.html#insertBlock">insertBlock</a>().</p>
<p>Existing fragments of text can be inserted with <a href="qtextcursor.html#insertFragment">insertFragment</a>() but, if you want to insert pieces of text in various formats, it is usually still easier to use <a href="qtextcursor.html#insertText">insertText</a>() and supply a character format.</p>
<p>Various types of higher-level structure can also be inserted into the document with the cursor:</p>
<ul>
<li>Lists are ordered sequences of block elements that are decorated with bullet points or symbols. These are inserted in a specified format with <a href="qtextcursor.html#insertList">insertList</a>().</li>
<li>Tables are inserted with the <a href="qtextcursor.html#insertTable">insertTable</a>() function, and can be given an optional format. These contain an array of cells that can be traversed using the cursor.</li>
<li>Inline images are inserted with <a href="qtextcursor.html#insertImage">insertImage</a>(). The image to be used can be specified in an image format, or by name.</li>
<li>Frames are inserted by calling <a href="qtextcursor.html#insertFrame">insertFrame</a>() with a specified format.</li>
</ul>
<p>Actions can be grouped (i.e&#x2e; treated as a single action for undo/redo) using <a href="qtextcursor.html#beginEditBlock">beginEditBlock</a>() and <a href="qtextcursor.html#endEditBlock">endEditBlock</a>().</p>
<p>Cursor movements are limited to valid cursor positions. In Latin writing this is between any two consecutive characters in the text, before the first character, or after the last character. In some other writing systems cursor movements are limited to &quot;clusters&quot; (e.g&#x2e; a syllable in Devanagari, or a base letter plus diacritics). Functions such as <a href="qtextcursor.html#movePosition">movePosition</a>() and <a href="qtextcursor.html#deleteChar">deleteChar</a>() limit cursor movement to these valid positions.</p>
</div>
<p><b>See also </b><a href="richtext.html">Rich Text Processing</a>.</p>
<!-- @@@QTextCursor -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$MoveMode$$$MoveAnchor$$$KeepAnchor -->
<h3 class="fn" id="MoveMode-enum"><a name="MoveMode-enum"></a>enum QTextCursor::<span class="name">MoveMode</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>QTextCursor::MoveAnchor</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Moves the anchor to the same position as the cursor itself.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::KeepAnchor</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Keeps the anchor where it is.</td></tr>
</table></div>
<p>If the <a href="qtextcursor.html#anchor">anchor</a>() is kept where it is and the <a href="qtextcursor.html#position">position</a>() is moved, the text in between will be selected.</p>
<!-- @@@MoveMode -->
<!-- $$$MoveOperation$$$NoMove$$$Start$$$Up$$$StartOfLine$$$StartOfBlock$$$StartOfWord$$$PreviousBlock$$$PreviousCharacter$$$PreviousWord$$$Left$$$WordLeft$$$End$$$Down$$$EndOfLine$$$EndOfWord$$$EndOfBlock$$$NextBlock$$$NextCharacter$$$NextWord$$$Right$$$WordRight$$$NextCell$$$PreviousCell$$$NextRow$$$PreviousRow -->
<h3 class="fn" id="MoveOperation-enum"><a name="MoveOperation-enum"></a>enum QTextCursor::<span class="name">MoveOperation</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>QTextCursor::NoMove</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Keep the cursor where it is</td></tr>
<tr><td class="topAlign"><code>QTextCursor::Start</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Move to the start of the document.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::StartOfLine</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Move to the start of the current line.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::StartOfBlock</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">Move to the start of the current block.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::StartOfWord</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">Move to the start of the current word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::PreviousBlock</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">Move to the start of the previous block.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::PreviousCharacter</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">Move to the previous character.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::PreviousWord</code></td><td class="topAlign tblval"><code>8</code></td><td class="topAlign">Move to the beginning of the previous word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::Up</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">Move up one line.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::Left</code></td><td class="topAlign tblval"><code>9</code></td><td class="topAlign">Move left one character.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::WordLeft</code></td><td class="topAlign tblval"><code>10</code></td><td class="topAlign">Move left one word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::End</code></td><td class="topAlign tblval"><code>11</code></td><td class="topAlign">Move to the end of the document.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::EndOfLine</code></td><td class="topAlign tblval"><code>13</code></td><td class="topAlign">Move to the end of the current line.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::EndOfWord</code></td><td class="topAlign tblval"><code>14</code></td><td class="topAlign">Move to the end of the current word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::EndOfBlock</code></td><td class="topAlign tblval"><code>15</code></td><td class="topAlign">Move to the end of the current block.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::NextBlock</code></td><td class="topAlign tblval"><code>16</code></td><td class="topAlign">Move to the beginning of the next block.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::NextCharacter</code></td><td class="topAlign tblval"><code>17</code></td><td class="topAlign">Move to the next character.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::NextWord</code></td><td class="topAlign tblval"><code>18</code></td><td class="topAlign">Move to the next word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::Down</code></td><td class="topAlign tblval"><code>12</code></td><td class="topAlign">Move down one line.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::Right</code></td><td class="topAlign tblval"><code>19</code></td><td class="topAlign">Move right one character.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::WordRight</code></td><td class="topAlign tblval"><code>20</code></td><td class="topAlign">Move right one word.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::NextCell</code></td><td class="topAlign tblval"><code>21</code></td><td class="topAlign">Move to the beginning of the next table cell inside the current table. If the current cell is the last cell in the row, the cursor will move to the first cell in the next row.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::PreviousCell</code></td><td class="topAlign tblval"><code>22</code></td><td class="topAlign">Move to the beginning of the previous table cell inside the current table. If the current cell is the first cell in the row, the cursor will move to the last cell in the previous row.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::NextRow</code></td><td class="topAlign tblval"><code>23</code></td><td class="topAlign">Move to the first new cell of the next row in the current table.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::PreviousRow</code></td><td class="topAlign tblval"><code>24</code></td><td class="topAlign">Move to the last cell of the previous row in the current table.</td></tr>
</table></div>
<p><b>See also </b><a href="qtextcursor.html#movePosition">movePosition</a>().</p>
<!-- @@@MoveOperation -->
<!-- $$$SelectionType$$$WordUnderCursor$$$LineUnderCursor$$$BlockUnderCursor$$$Document -->
<h3 class="fn" id="SelectionType-enum"><a name="SelectionType-enum"></a>enum QTextCursor::<span class="name">SelectionType</span></h3>
<p>This enum describes the types of selection that can be applied with the <a href="qtextcursor.html#select">select</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>QTextCursor::Document</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Selects the entire document.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::BlockUnderCursor</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">Selects the block of text under the cursor.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::LineUnderCursor</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Selects the line of text under the cursor.</td></tr>
<tr><td class="topAlign"><code>QTextCursor::WordUnderCursor</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Selects the word under the cursor. If the cursor is not positioned within a string of selectable characters, no text is selected.</td></tr>
</table></div>
<!-- @@@SelectionType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextCursor[overload1]$$$QTextCursor -->
<h3 class="fn" id="QTextCursor"><a name="QTextCursor"></a>QTextCursor::<span class="name">QTextCursor</span>()</h3>
<p>Constructs a null cursor.</p>
<!-- @@@QTextCursor -->
<!-- $$$QTextCursor$$$QTextCursorQTextDocument* -->
<h3 class="fn" id="QTextCursor-1"><a name="QTextCursor-1"></a>QTextCursor::<span class="name">QTextCursor</span>(<span class="type"><a href="qtextdocument.html">QTextDocument</a></span> *<i>document</i>)</h3>
<p>Constructs a cursor pointing to the beginning of the <i>document</i>.</p>
<!-- @@@QTextCursor -->
<!-- $$$QTextCursor$$$QTextCursorQTextFrame* -->
<h3 class="fn" id="QTextCursor-4"><a name="QTextCursor-4"></a>QTextCursor::<span class="name">QTextCursor</span>(<span class="type"><a href="qtextframe.html">QTextFrame</a></span> *<i>frame</i>)</h3>
<p>Constructs a cursor pointing to the beginning of the <i>frame</i>.</p>
<!-- @@@QTextCursor -->
<!-- $$$QTextCursor$$$QTextCursorconstQTextBlock& -->
<h3 class="fn" id="QTextCursor-5"><a name="QTextCursor-5"></a>QTextCursor::<span class="name">QTextCursor</span>(const <span class="type"><a href="qtextblock.html">QTextBlock</a></span> &amp;<i>block</i>)</h3>
<p>Constructs a cursor pointing to the beginning of the <i>block</i>.</p>
<!-- @@@QTextCursor -->
<!-- $$$QTextCursor$$$QTextCursorconstQTextCursor& -->
<h3 class="fn" id="QTextCursor-6"><a name="QTextCursor-6"></a>QTextCursor::<span class="name">QTextCursor</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>cursor</i>)</h3>
<p>Constructs a new cursor that is a copy of <i>cursor</i>.</p>
<!-- @@@QTextCursor -->
<!-- $$$~QTextCursor[overload1]$$$~QTextCursor -->
<h3 class="fn" id="dtor.QTextCursor"><a name="dtor.QTextCursor"></a>QTextCursor::<span class="name">~QTextCursor</span>()</h3>
<p>Destroys the <a href="qtextcursor.html">QTextCursor</a>.</p>
<!-- @@@~QTextCursor -->
<!-- $$$anchor[overload1]$$$anchor -->
<h3 class="fn" id="anchor"><a name="anchor"></a><span class="type">int</span> QTextCursor::<span class="name">anchor</span>() const</h3>
<p>Returns the anchor position; this is the same as <a href="qtextcursor.html#position">position</a>() unless there is a selection in which case <a href="qtextcursor.html#position">position</a>() marks one end of the selection and anchor() marks the other end. Just like the cursor position, the anchor position is between characters.</p>
<p><b>See also </b><a href="qtextcursor.html#position">position</a>(), <a href="qtextcursor.html#setPosition">setPosition</a>(), <a href="qtextcursor.html#movePosition">movePosition</a>(), <a href="qtextcursor.html#selectionStart">selectionStart</a>(), and <a href="qtextcursor.html#selectionEnd">selectionEnd</a>().</p>
<!-- @@@anchor -->
<!-- $$$atBlockEnd[overload1]$$$atBlockEnd -->
<h3 class="fn" id="atBlockEnd"><a name="atBlockEnd"></a><span class="type">bool</span> QTextCursor::<span class="name">atBlockEnd</span>() const</h3>
<p>Returns <code>true</code> if the cursor is at the end of a block; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtextcursor.html#atBlockStart">atBlockStart</a>() and <a href="qtextcursor.html#atEnd">atEnd</a>().</p>
<!-- @@@atBlockEnd -->
<!-- $$$atBlockStart[overload1]$$$atBlockStart -->
<h3 class="fn" id="atBlockStart"><a name="atBlockStart"></a><span class="type">bool</span> QTextCursor::<span class="name">atBlockStart</span>() const</h3>
<p>Returns <code>true</code> if the cursor is at the start of a block; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtextcursor.html#atBlockEnd">atBlockEnd</a>() and <a href="qtextcursor.html#atStart">atStart</a>().</p>
<!-- @@@atBlockStart -->
<!-- $$$atEnd[overload1]$$$atEnd -->
<h3 class="fn" id="atEnd"><a name="atEnd"></a><span class="type">bool</span> QTextCursor::<span class="name">atEnd</span>() const</h3>
<p>Returns <code>true</code> if the cursor is at the end of the document; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qtextcursor.html#atStart">atStart</a>() and <a href="qtextcursor.html#atBlockEnd">atBlockEnd</a>().</p>
<!-- @@@atEnd -->
<!-- $$$atStart[overload1]$$$atStart -->
<h3 class="fn" id="atStart"><a name="atStart"></a><span class="type">bool</span> QTextCursor::<span class="name">atStart</span>() const</h3>
<p>Returns <code>true</code> if the cursor is at the start of the document; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtextcursor.html#atBlockStart">atBlockStart</a>() and <a href="qtextcursor.html#atEnd">atEnd</a>().</p>
<!-- @@@atStart -->
<!-- $$$beginEditBlock[overload1]$$$beginEditBlock -->
<h3 class="fn" id="beginEditBlock"><a name="beginEditBlock"></a><span class="type">void</span> QTextCursor::<span class="name">beginEditBlock</span>()</h3>
<p>Indicates the start of a block of editing operations on the document that should appear as a single operation from an undo/redo point of view.</p>
<p>For example:</p>
<pre class="cpp">

  <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> cursor(textDocument);
  cursor<span class="operator">.</span>beginEditBlock();
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;Hello&quot;</span>);
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;World&quot;</span>);
  cursor<span class="operator">.</span>endEditBlock();

  textDocument<span class="operator">-</span><span class="operator">&gt;</span>undo();

</pre>
<p>The call to undo() will cause both insertions to be undone, causing both &quot;World&quot; and &quot;Hello&quot; to be removed.</p>
<p>It is possible to nest calls to beginEditBlock and <a href="qtextcursor.html#endEditBlock">endEditBlock</a>. The top-most pair will determine the scope of the undo/redo operation.</p>
<p><b>See also </b><a href="qtextcursor.html#endEditBlock">endEditBlock</a>().</p>
<!-- @@@beginEditBlock -->
<!-- $$$block[overload1]$$$block -->
<h3 class="fn" id="block"><a name="block"></a><span class="type"><a href="qtextblock.html">QTextBlock</a></span> QTextCursor::<span class="name">block</span>() const</h3>
<p>Returns the block that contains the cursor.</p>
<!-- @@@block -->
<!-- $$$blockCharFormat[overload1]$$$blockCharFormat -->
<h3 class="fn" id="blockCharFormat"><a name="blockCharFormat"></a><span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> QTextCursor::<span class="name">blockCharFormat</span>() const</h3>
<p>Returns the block character format of the block the cursor is in.</p>
<p>The block char format is the format used when inserting text at the beginning of an empty block.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockCharFormat">setBlockCharFormat</a>().</p>
<!-- @@@blockCharFormat -->
<!-- $$$blockFormat[overload1]$$$blockFormat -->
<h3 class="fn" id="blockFormat"><a name="blockFormat"></a><span class="type"><a href="qtextblockformat.html">QTextBlockFormat</a></span> QTextCursor::<span class="name">blockFormat</span>() const</h3>
<p>Returns the block format of the block the cursor is in.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>() and <a href="qtextcursor.html#charFormat">charFormat</a>().</p>
<!-- @@@blockFormat -->
<!-- $$$blockNumber[overload1]$$$blockNumber -->
<h3 class="fn" id="blockNumber"><a name="blockNumber"></a><span class="type">int</span> QTextCursor::<span class="name">blockNumber</span>() const</h3>
<p>Returns the number of the block the cursor is in, or 0 if the cursor is invalid.</p>
<p>Note that this function only makes sense in documents without complex objects such as tables or frames.</p>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@blockNumber -->
<!-- $$$charFormat[overload1]$$$charFormat -->
<h3 class="fn" id="charFormat"><a name="charFormat"></a><span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> QTextCursor::<span class="name">charFormat</span>() const</h3>
<p>Returns the format of the character immediately before the cursor <a href="qtextcursor.html#position">position</a>(). If the cursor is positioned at the beginning of a text block that is not empty then the format of the character immediately after the cursor is returned.</p>
<p><b>See also </b><a href="qtextcursor.html#setCharFormat">setCharFormat</a>(), <a href="qtextcursor.html#insertText">insertText</a>(), and <a href="qtextcursor.html#blockFormat">blockFormat</a>().</p>
<!-- @@@charFormat -->
<!-- $$$clearSelection[overload1]$$$clearSelection -->
<h3 class="fn" id="clearSelection"><a name="clearSelection"></a><span class="type">void</span> QTextCursor::<span class="name">clearSelection</span>()</h3>
<p>Clears the current selection by setting the anchor to the cursor position.</p>
<p>Note that it does <b>not</b> delete the text of the selection.</p>
<p><b>See also </b><a href="qtextcursor.html#removeSelectedText">removeSelectedText</a>() and <a href="qtextcursor.html#hasSelection">hasSelection</a>().</p>
<!-- @@@clearSelection -->
<!-- $$$columnNumber[overload1]$$$columnNumber -->
<h3 class="fn" id="columnNumber"><a name="columnNumber"></a><span class="type">int</span> QTextCursor::<span class="name">columnNumber</span>() const</h3>
<p>Returns the position of the cursor within its containing line.</p>
<p>Note that this is the column number relative to a wrapped line, not relative to the block (i.e&#x2e; the paragraph).</p>
<p>You probably want to call <a href="qtextcursor.html#positionInBlock">positionInBlock</a>() instead.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qtextcursor.html#positionInBlock">positionInBlock</a>().</p>
<!-- @@@columnNumber -->
<!-- $$$createList[overload1]$$$createListconstQTextListFormat& -->
<h3 class="fn" id="createList"><a name="createList"></a><span class="type"><a href="qtextlist.html">QTextList</a></span> *QTextCursor::<span class="name">createList</span>(const <span class="type"><a href="qtextlistformat.html">QTextListFormat</a></span> &amp;<i>format</i>)</h3>
<p>Creates and returns a new list with the given <i>format</i>, and makes the current paragraph the cursor is in the first list item.</p>
<p><b>See also </b><a href="qtextcursor.html#insertList">insertList</a>() and <a href="qtextcursor.html#currentList">currentList</a>().</p>
<!-- @@@createList -->
<!-- $$$createList$$$createListQTextListFormat::Style -->
<h3 class="fn" id="createList-1"><a name="createList-1"></a><span class="type"><a href="qtextlist.html">QTextList</a></span> *QTextCursor::<span class="name">createList</span>(<span class="type"><a href="qtextlistformat.html#Style-enum">QTextListFormat::Style</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a new list with the given <i>style</i>, making the cursor's current paragraph the first list item.</p>
<p>The style to be used is defined by the <a href="qtextlistformat.html#Style-enum">QTextListFormat::Style</a> enum.</p>
<p><b>See also </b><a href="qtextcursor.html#insertList">insertList</a>() and <a href="qtextcursor.html#currentList">currentList</a>().</p>
<!-- @@@createList -->
<!-- $$$currentFrame[overload1]$$$currentFrame -->
<h3 class="fn" id="currentFrame"><a name="currentFrame"></a><span class="type"><a href="qtextframe.html">QTextFrame</a></span> *QTextCursor::<span class="name">currentFrame</span>() const</h3>
<p>Returns a pointer to the current frame. Returns 0 if the cursor is invalid.</p>
<p><b>See also </b><a href="qtextcursor.html#insertFrame">insertFrame</a>().</p>
<!-- @@@currentFrame -->
<!-- $$$currentList[overload1]$$$currentList -->
<h3 class="fn" id="currentList"><a name="currentList"></a><span class="type"><a href="qtextlist.html">QTextList</a></span> *QTextCursor::<span class="name">currentList</span>() const</h3>
<p>Returns the current list if the cursor <a href="qtextcursor.html#position">position</a>() is inside a block that is part of a list; otherwise returns 0.</p>
<p><b>See also </b><a href="qtextcursor.html#insertList">insertList</a>() and <a href="qtextcursor.html#createList">createList</a>().</p>
<!-- @@@currentList -->
<!-- $$$currentTable[overload1]$$$currentTable -->
<h3 class="fn" id="currentTable"><a name="currentTable"></a><span class="type"><a href="qtexttable.html">QTextTable</a></span> *QTextCursor::<span class="name">currentTable</span>() const</h3>
<p>Returns a pointer to the current table if the cursor <a href="qtextcursor.html#position">position</a>() is inside a block that is part of a table; otherwise returns 0.</p>
<p><b>See also </b><a href="qtextcursor.html#insertTable">insertTable</a>().</p>
<!-- @@@currentTable -->
<!-- $$$deleteChar[overload1]$$$deleteChar -->
<h3 class="fn" id="deleteChar"><a name="deleteChar"></a><span class="type">void</span> QTextCursor::<span class="name">deleteChar</span>()</h3>
<p>If there is no selected text, deletes the character <i>at</i> the current cursor position; otherwise deletes the selected text.</p>
<p><b>See also </b><a href="qtextcursor.html#deletePreviousChar">deletePreviousChar</a>(), <a href="qtextcursor.html#hasSelection">hasSelection</a>(), and <a href="qtextcursor.html#clearSelection">clearSelection</a>().</p>
<!-- @@@deleteChar -->
<!-- $$$deletePreviousChar[overload1]$$$deletePreviousChar -->
<h3 class="fn" id="deletePreviousChar"><a name="deletePreviousChar"></a><span class="type">void</span> QTextCursor::<span class="name">deletePreviousChar</span>()</h3>
<p>If there is no selected text, deletes the character <i>before</i> the current cursor position; otherwise deletes the selected text.</p>
<p><b>See also </b><a href="qtextcursor.html#deleteChar">deleteChar</a>(), <a href="qtextcursor.html#hasSelection">hasSelection</a>(), and <a href="qtextcursor.html#clearSelection">clearSelection</a>().</p>
<!-- @@@deletePreviousChar -->
<!-- $$$document[overload1]$$$document -->
<h3 class="fn" id="document"><a name="document"></a><span class="type"><a href="qtextdocument.html">QTextDocument</a></span> *QTextCursor::<span class="name">document</span>() const</h3>
<p>Returns the document this cursor is associated with.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@document -->
<!-- $$$endEditBlock[overload1]$$$endEditBlock -->
<h3 class="fn" id="endEditBlock"><a name="endEditBlock"></a><span class="type">void</span> QTextCursor::<span class="name">endEditBlock</span>()</h3>
<p>Indicates the end of a block of editing operations on the document that should appear as a single operation from an undo/redo point of view.</p>
<p><b>See also </b><a href="qtextcursor.html#beginEditBlock">beginEditBlock</a>().</p>
<!-- @@@endEditBlock -->
<!-- $$$hasComplexSelection[overload1]$$$hasComplexSelection -->
<h3 class="fn" id="hasComplexSelection"><a name="hasComplexSelection"></a><span class="type">bool</span> QTextCursor::<span class="name">hasComplexSelection</span>() const</h3>
<p>Returns <code>true</code> if the cursor contains a selection that is not simply a range from <a href="qtextcursor.html#selectionStart">selectionStart</a>() to <a href="qtextcursor.html#selectionEnd">selectionEnd</a>(); otherwise returns <code>false</code>.</p>
<p>Complex selections are ones that span at least two cells in a table; their extent is specified by <a href="qtextcursor.html#selectedTableCells">selectedTableCells</a>().</p>
<!-- @@@hasComplexSelection -->
<!-- $$$hasSelection[overload1]$$$hasSelection -->
<h3 class="fn" id="hasSelection"><a name="hasSelection"></a><span class="type">bool</span> QTextCursor::<span class="name">hasSelection</span>() const</h3>
<p>Returns <code>true</code> if the cursor contains a selection; otherwise returns <code>false</code>.</p>
<!-- @@@hasSelection -->
<!-- $$$insertBlock[overload1]$$$insertBlock -->
<h3 class="fn" id="insertBlock"><a name="insertBlock"></a><span class="type">void</span> QTextCursor::<span class="name">insertBlock</span>()</h3>
<p>Inserts a new empty block at the cursor <a href="qtextcursor.html#position">position</a>() with the current <a href="qtextcursor.html#blockFormat">blockFormat</a>() and <a href="qtextcursor.html#charFormat">charFormat</a>().</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>().</p>
<!-- @@@insertBlock -->
<!-- $$$insertBlock$$$insertBlockconstQTextBlockFormat& -->
<h3 class="fn" id="insertBlock-1"><a name="insertBlock-1"></a><span class="type">void</span> QTextCursor::<span class="name">insertBlock</span>(const <span class="type"><a href="qtextblockformat.html">QTextBlockFormat</a></span> &amp;<i>format</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts a new empty block at the cursor <a href="qtextcursor.html#position">position</a>() with block format <i>format</i> and the current <a href="qtextcursor.html#charFormat">charFormat</a>() as block char format.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>().</p>
<!-- @@@insertBlock -->
<!-- $$$insertBlock$$$insertBlockconstQTextBlockFormat&constQTextCharFormat& -->
<h3 class="fn" id="insertBlock-2"><a name="insertBlock-2"></a><span class="type">void</span> QTextCursor::<span class="name">insertBlock</span>(const <span class="type"><a href="qtextblockformat.html">QTextBlockFormat</a></span> &amp;<i>format</i>, const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>charFormat</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts a new empty block at the cursor <a href="qtextcursor.html#position">position</a>() with block format <i>format</i> and <i>charFormat</i> as block char format.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>().</p>
<!-- @@@insertBlock -->
<!-- $$$insertFragment[overload1]$$$insertFragmentconstQTextDocumentFragment& -->
<h3 class="fn" id="insertFragment"><a name="insertFragment"></a><span class="type">void</span> QTextCursor::<span class="name">insertFragment</span>(const <span class="type"><a href="qtextdocumentfragment.html">QTextDocumentFragment</a></span> &amp;<i>fragment</i>)</h3>
<p>Inserts the text <i>fragment</i> at the current <a href="qtextcursor.html#position">position</a>().</p>
<!-- @@@insertFragment -->
<!-- $$$insertFrame[overload1]$$$insertFrameconstQTextFrameFormat& -->
<h3 class="fn" id="insertFrame"><a name="insertFrame"></a><span class="type"><a href="qtextframe.html">QTextFrame</a></span> *QTextCursor::<span class="name">insertFrame</span>(const <span class="type"><a href="qtextframeformat.html">QTextFrameFormat</a></span> &amp;<i>format</i>)</h3>
<p>Inserts a frame with the given <i>format</i> at the current cursor <a href="qtextcursor.html#position">position</a>(), moves the cursor <a href="qtextcursor.html#position">position</a>() inside the frame, and returns the frame.</p>
<p>If the cursor holds a selection, the whole selection is moved inside the frame.</p>
<p><b>See also </b><a href="qtextcursor.html#hasSelection">hasSelection</a>().</p>
<!-- @@@insertFrame -->
<!-- $$$insertHtml[overload1]$$$insertHtmlconstQString& -->
<h3 class="fn" id="insertHtml"><a name="insertHtml"></a><span class="type">void</span> QTextCursor::<span class="name">insertHtml</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>html</i>)</h3>
<p>Inserts the text <i>html</i> at the current <a href="qtextcursor.html#position">position</a>(). The text is interpreted as HTML.</p>
<p><b>Note: </b>When using this function with a style sheet, the style sheet will only apply to the current block in the document. In order to apply a style sheet throughout a document, use <a href="qtextdocument.html#defaultStyleSheet-prop">QTextDocument::setDefaultStyleSheet</a>() instead.</p><p>This function was introduced in  Qt 4.2.</p>
<!-- @@@insertHtml -->
<!-- $$$insertImage[overload1]$$$insertImageconstQTextImageFormat& -->
<h3 class="fn" id="insertImage"><a name="insertImage"></a><span class="type">void</span> QTextCursor::<span class="name">insertImage</span>(const <span class="type"><a href="qtextimageformat.html">QTextImageFormat</a></span> &amp;<i>format</i>)</h3>
<p>Inserts the image defined by <i>format</i> at the current <a href="qtextcursor.html#position">position</a>().</p>
<!-- @@@insertImage -->
<!-- $$$insertImage$$$insertImageconstQTextImageFormat&QTextFrameFormat::Position -->
<h3 class="fn" id="insertImage-1"><a name="insertImage-1"></a><span class="type">void</span> QTextCursor::<span class="name">insertImage</span>(const <span class="type"><a href="qtextimageformat.html">QTextImageFormat</a></span> &amp;<i>format</i>, <span class="type"><a href="qtextframeformat.html#Position-enum">QTextFrameFormat::Position</a></span> <i>alignment</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts the image defined by the given <i>format</i> at the cursor's current position with the specified <i>alignment</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qtextcursor.html#position">position</a>().</p>
<!-- @@@insertImage -->
<!-- $$$insertImage$$$insertImageconstQString& -->
<h3 class="fn" id="insertImage-2"><a name="insertImage-2"></a><span class="type">void</span> QTextCursor::<span class="name">insertImage</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>This is an overloaded function.</p>
<p>Convenience method for inserting the image with the given <i>name</i> at the current <a href="qtextcursor.html#position">position</a>().</p>
<pre class="cpp">

  <span class="type"><a href="qimage.html">QImage</a></span> img <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  textDocument<span class="operator">-</span><span class="operator">&gt;</span>addResource(<span class="type"><a href="qtextdocument.html">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;myimage&quot;</span>)<span class="operator">,</span> img);
  cursor<span class="operator">.</span>insertImage(<span class="string">&quot;myimage&quot;</span>);

</pre>
<!-- @@@insertImage -->
<!-- $$$insertImage$$$insertImageconstQImage&constQString& -->
<h3 class="fn" id="insertImage-3"><a name="insertImage-3"></a><span class="type">void</span> QTextCursor::<span class="name">insertImage</span>(const <span class="type"><a href="qimage.html">QImage</a></span> &amp;<i>image</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i> = QString())</h3>
<p>This is an overloaded function.</p>
<p>Convenience function for inserting the given <i>image</i> with an optional <i>name</i> at the current <a href="qtextcursor.html#position">position</a>().</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@insertImage -->
<!-- $$$insertList[overload1]$$$insertListconstQTextListFormat& -->
<h3 class="fn" id="insertList"><a name="insertList"></a><span class="type"><a href="qtextlist.html">QTextList</a></span> *QTextCursor::<span class="name">insertList</span>(const <span class="type"><a href="qtextlistformat.html">QTextListFormat</a></span> &amp;<i>format</i>)</h3>
<p>Inserts a new block at the current position and makes it the first list item of a newly created list with the given <i>format</i>. Returns the created list.</p>
<p><b>See also </b><a href="qtextcursor.html#currentList">currentList</a>(), <a href="qtextcursor.html#createList">createList</a>(), and <a href="qtextcursor.html#insertBlock">insertBlock</a>().</p>
<!-- @@@insertList -->
<!-- $$$insertList$$$insertListQTextListFormat::Style -->
<h3 class="fn" id="insertList-1"><a name="insertList-1"></a><span class="type"><a href="qtextlist.html">QTextList</a></span> *QTextCursor::<span class="name">insertList</span>(<span class="type"><a href="qtextlistformat.html#Style-enum">QTextListFormat::Style</a></span> <i>style</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts a new block at the current position and makes it the first list item of a newly created list with the given <i>style</i>. Returns the created list.</p>
<p><b>See also </b><a href="qtextcursor.html#currentList">currentList</a>(), <a href="qtextcursor.html#createList">createList</a>(), and <a href="qtextcursor.html#insertBlock">insertBlock</a>().</p>
<!-- @@@insertList -->
<!-- $$$insertTable[overload1]$$$insertTableintintconstQTextTableFormat& -->
<h3 class="fn" id="insertTable"><a name="insertTable"></a><span class="type"><a href="qtexttable.html">QTextTable</a></span> *QTextCursor::<span class="name">insertTable</span>(<span class="type">int</span> <i>rows</i>, <span class="type">int</span> <i>columns</i>, const <span class="type"><a href="qtexttableformat.html">QTextTableFormat</a></span> &amp;<i>format</i>)</h3>
<p>Creates a new table with the given number of <i>rows</i> and <i>columns</i> in the specified <i>format</i>, inserts it at the current cursor <a href="qtextcursor.html#position">position</a>() in the document, and returns the table object. The cursor is moved to the beginning of the first cell.</p>
<p>There must be at least one row and one column in the table.</p>
<p><b>See also </b><a href="qtextcursor.html#currentTable">currentTable</a>().</p>
<!-- @@@insertTable -->
<!-- $$$insertTable$$$insertTableintint -->
<h3 class="fn" id="insertTable-1"><a name="insertTable-1"></a><span class="type"><a href="qtexttable.html">QTextTable</a></span> *QTextCursor::<span class="name">insertTable</span>(<span class="type">int</span> <i>rows</i>, <span class="type">int</span> <i>columns</i>)</h3>
<p>This is an overloaded function.</p>
<p>Creates a new table with the given number of <i>rows</i> and <i>columns</i>, inserts it at the current cursor <a href="qtextcursor.html#position">position</a>() in the document, and returns the table object. The cursor is moved to the beginning of the first cell.</p>
<p>There must be at least one row and one column in the table.</p>
<p><b>See also </b><a href="qtextcursor.html#currentTable">currentTable</a>().</p>
<!-- @@@insertTable -->
<!-- $$$insertText[overload1]$$$insertTextconstQString& -->
<h3 class="fn" id="insertText"><a name="insertText"></a><span class="type">void</span> QTextCursor::<span class="name">insertText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Inserts <i>text</i> at the current position, using the current character format.</p>
<p>If there is a selection, the selection is deleted and replaced by <i>text</i>, for example:</p>
<pre class="cpp">

  cursor<span class="operator">.</span>clearSelection();
  cursor<span class="operator">.</span>movePosition(<span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span><span class="operator">::</span>NextWord<span class="operator">,</span> <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span><span class="operator">::</span>KeepAnchor);
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;Hello World&quot;</span>);

</pre>
<p>This clears any existing selection, selects the word at the cursor (i.e&#x2e; from <a href="qtextcursor.html#position">position</a>() forward), and replaces the selection with the phrase &quot;Hello World&quot;.</p>
<p>Any ASCII linefeed characters (\n) in the inserted text are transformed into unicode block separators, corresponding to <a href="qtextcursor.html#insertBlock">insertBlock</a>() calls.</p>
<p><b>See also </b><a href="qtextcursor.html#charFormat">charFormat</a>() and <a href="qtextcursor.html#hasSelection">hasSelection</a>().</p>
<!-- @@@insertText -->
<!-- $$$insertText$$$insertTextconstQString&constQTextCharFormat& -->
<h3 class="fn" id="insertText-1"><a name="insertText-1"></a><span class="type">void</span> QTextCursor::<span class="name">insertText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>format</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts <i>text</i> at the current position with the given <i>format</i>.</p>
<!-- @@@insertText -->
<!-- $$$isCopyOf[overload1]$$$isCopyOfconstQTextCursor& -->
<h3 class="fn" id="isCopyOf"><a name="isCopyOf"></a><span class="type">bool</span> QTextCursor::<span class="name">isCopyOf</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if this cursor and <i>other</i> are copies of each other, i.e&#x2e; one of them was created as a copy of the other and neither has moved since. This is much stricter than equality.</p>
<p><b>See also </b><a href="qtextcursor.html#operator-eq">operator=</a>() and <a href="qtextcursor.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@isCopyOf -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QTextCursor::<span class="name">isNull</span>() const</h3>
<p>Returns <code>true</code> if the cursor is null; otherwise returns <code>false</code>. A null cursor is created by the default constructor.</p>
<!-- @@@isNull -->
<!-- $$$joinPreviousEditBlock[overload1]$$$joinPreviousEditBlock -->
<h3 class="fn" id="joinPreviousEditBlock"><a name="joinPreviousEditBlock"></a><span class="type">void</span> QTextCursor::<span class="name">joinPreviousEditBlock</span>()</h3>
<p>Like <a href="qtextcursor.html#beginEditBlock">beginEditBlock</a>() indicates the start of a block of editing operations that should appear as a single operation for undo/redo. However unlike <a href="qtextcursor.html#beginEditBlock">beginEditBlock</a>() it does not start a new block but reverses the previous call to <a href="qtextcursor.html#endEditBlock">endEditBlock</a>() and therefore makes following operations part of the previous edit block created.</p>
<p>For example:</p>
<pre class="cpp">

  <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> cursor(textDocument);
  cursor<span class="operator">.</span>beginEditBlock();
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;Hello&quot;</span>);
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;World&quot;</span>);
  cursor<span class="operator">.</span>endEditBlock();

  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

  cursor<span class="operator">.</span>joinPreviousEditBlock();
  cursor<span class="operator">.</span>insertText(<span class="string">&quot;Hey&quot;</span>);
  cursor<span class="operator">.</span>endEditBlock();

  textDocument<span class="operator">-</span><span class="operator">&gt;</span>undo();

</pre>
<p>The call to undo() will cause all three insertions to be undone.</p>
<p><b>See also </b><a href="qtextcursor.html#beginEditBlock">beginEditBlock</a>() and <a href="qtextcursor.html#endEditBlock">endEditBlock</a>().</p>
<!-- @@@joinPreviousEditBlock -->
<!-- $$$keepPositionOnInsert[overload1]$$$keepPositionOnInsert -->
<h3 class="fn" id="keepPositionOnInsert"><a name="keepPositionOnInsert"></a><span class="type">bool</span> QTextCursor::<span class="name">keepPositionOnInsert</span>() const</h3>
<p>Returns whether the cursor should keep its current position when text gets inserted at the position of the cursor.</p>
<p>The default is false;</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextcursor.html#setKeepPositionOnInsert">setKeepPositionOnInsert</a>().</p>
<!-- @@@keepPositionOnInsert -->
<!-- $$$mergeBlockCharFormat[overload1]$$$mergeBlockCharFormatconstQTextCharFormat& -->
<h3 class="fn" id="mergeBlockCharFormat"><a name="mergeBlockCharFormat"></a><span class="type">void</span> QTextCursor::<span class="name">mergeBlockCharFormat</span>(const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>modifier</i>)</h3>
<p>Modifies the block char format of the current block (or all blocks that are contained in the selection) with the block format specified by <i>modifier</i>.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockCharFormat">setBlockCharFormat</a>().</p>
<!-- @@@mergeBlockCharFormat -->
<!-- $$$mergeBlockFormat[overload1]$$$mergeBlockFormatconstQTextBlockFormat& -->
<h3 class="fn" id="mergeBlockFormat"><a name="mergeBlockFormat"></a><span class="type">void</span> QTextCursor::<span class="name">mergeBlockFormat</span>(const <span class="type"><a href="qtextblockformat.html">QTextBlockFormat</a></span> &amp;<i>modifier</i>)</h3>
<p>Modifies the block format of the current block (or all blocks that are contained in the selection) with the block format specified by <i>modifier</i>.</p>
<p><b>See also </b><a href="qtextcursor.html#setBlockFormat">setBlockFormat</a>() and <a href="qtextcursor.html#blockFormat">blockFormat</a>().</p>
<!-- @@@mergeBlockFormat -->
<!-- $$$mergeCharFormat[overload1]$$$mergeCharFormatconstQTextCharFormat& -->
<h3 class="fn" id="mergeCharFormat"><a name="mergeCharFormat"></a><span class="type">void</span> QTextCursor::<span class="name">mergeCharFormat</span>(const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>modifier</i>)</h3>
<p>Merges the cursor's current character format with the properties described by format <i>modifier</i>. If the cursor has a selection, this function applies all the properties set in <i>modifier</i> to all the character formats that are part of the selection.</p>
<p><b>See also </b><a href="qtextcursor.html#hasSelection">hasSelection</a>() and <a href="qtextcursor.html#setCharFormat">setCharFormat</a>().</p>
<!-- @@@mergeCharFormat -->
<!-- $$$movePosition[overload1]$$$movePositionMoveOperationMoveModeint -->
<h3 class="fn" id="movePosition"><a name="movePosition"></a><span class="type">bool</span> QTextCursor::<span class="name">movePosition</span>(<span class="type"><a href="qtextcursor.html#MoveOperation-enum">MoveOperation</a></span> <i>operation</i>, <span class="type"><a href="qtextcursor.html#MoveMode-enum">MoveMode</a></span> <i>mode</i> = MoveAnchor, <span class="type">int</span> <i>n</i> = 1)</h3>
<p>Moves the cursor by performing the given <i>operation</i> <i>n</i> times, using the specified <i>mode</i>, and returns <code>true</code> if all operations were completed successfully; otherwise returns <code>false</code>.</p>
<p>For example, if this function is repeatedly used to seek to the end of the next word, it will eventually fail when the end of the document is reached.</p>
<p>By default, the move operation is performed once (<i>n</i> = 1).</p>
<p>If <i>mode</i> is <code>KeepAnchor</code>, the cursor selects the text it moves over. This is the same effect that the user achieves when they hold down the Shift key and move the cursor with the cursor keys.</p>
<p><b>See also </b><a href="qtextcursor.html#setVisualNavigation">setVisualNavigation</a>().</p>
<!-- @@@movePosition -->
<!-- $$$position[overload1]$$$position -->
<h3 class="fn" id="position"><a name="position"></a><span class="type">int</span> QTextCursor::<span class="name">position</span>() const</h3>
<p>Returns the absolute position of the cursor within the document. The cursor is positioned between characters.</p>
<p><b>See also </b><a href="qtextcursor.html#setPosition">setPosition</a>(), <a href="qtextcursor.html#movePosition">movePosition</a>(), <a href="qtextcursor.html#anchor">anchor</a>(), and <a href="qtextcursor.html#positionInBlock">positionInBlock</a>().</p>
<!-- @@@position -->
<!-- $$$positionInBlock[overload1]$$$positionInBlock -->
<h3 class="fn" id="positionInBlock"><a name="positionInBlock"></a><span class="type">int</span> QTextCursor::<span class="name">positionInBlock</span>() const</h3>
<p>Returns the relative position of the cursor within the block. The cursor is positioned between characters.</p>
<p>This is equivalent to <code>position() - block().position()</code>.</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextcursor.html#position">position</a>().</p>
<!-- @@@positionInBlock -->
<!-- $$$removeSelectedText[overload1]$$$removeSelectedText -->
<h3 class="fn" id="removeSelectedText"><a name="removeSelectedText"></a><span class="type">void</span> QTextCursor::<span class="name">removeSelectedText</span>()</h3>
<p>If there is a selection, its content is deleted; otherwise does nothing.</p>
<p><b>See also </b><a href="qtextcursor.html#hasSelection">hasSelection</a>().</p>
<!-- @@@removeSelectedText -->
<!-- $$$select[overload1]$$$selectSelectionType -->
<h3 class="fn" id="select"><a name="select"></a><span class="type">void</span> QTextCursor::<span class="name">select</span>(<span class="type"><a href="qtextcursor.html#SelectionType-enum">SelectionType</a></span> <i>selection</i>)</h3>
<p>Selects text in the document according to the given <i>selection</i>.</p>
<!-- @@@select -->
<!-- $$$selectedTableCells[overload1]$$$selectedTableCellsint*int*int*int* -->
<h3 class="fn" id="selectedTableCells"><a name="selectedTableCells"></a><span class="type">void</span> QTextCursor::<span class="name">selectedTableCells</span>(<span class="type">int</span> *<i>firstRow</i>, <span class="type">int</span> *<i>numRows</i>, <span class="type">int</span> *<i>firstColumn</i>, <span class="type">int</span> *<i>numColumns</i>) const</h3>
<p>If the selection spans over table cells, <i>firstRow</i> is populated with the number of the first row in the selection, <i>firstColumn</i> with the number of the first column in the selection, and <i>numRows</i> and <i>numColumns</i> with the number of rows and columns in the selection. If the selection does not span any table cells the results are harmless but undefined.</p>
<!-- @@@selectedTableCells -->
<!-- $$$selectedText[overload1]$$$selectedText -->
<h3 class="fn" id="selectedText"><a name="selectedText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextCursor::<span class="name">selectedText</span>() const</h3>
<p>Returns the current selection's text (which may be empty). This only returns the text, with no rich text formatting information. If you want a document fragment (i.e&#x2e; formatted rich text) use <a href="qtextcursor.html#selection">selection</a>() instead.</p>
<p><b>Note: </b>If the selection obtained from an editor spans a line break, the text will contain a Unicode U+2029 paragraph separator character instead of a newline <code>\n</code> character. Use <a href="../qtcore/qstring.html#replace-3">QString::replace</a>() to replace these characters with newlines.</p><!-- @@@selectedText -->
<!-- $$$selection[overload1]$$$selection -->
<h3 class="fn" id="selection"><a name="selection"></a><span class="type"><a href="qtextdocumentfragment.html">QTextDocumentFragment</a></span> QTextCursor::<span class="name">selection</span>() const</h3>
<p>Returns the current selection (which may be empty) with all its formatting information. If you just want the selected text (i.e&#x2e; plain text) use <a href="qtextcursor.html#selectedText">selectedText</a>() instead.</p>
<p><b>Note: </b>Unlike <a href="qtextdocumentfragment.html#toPlainText">QTextDocumentFragment::toPlainText</a>(), <a href="qtextcursor.html#selectedText">selectedText</a>() may include special unicode characters such as <a href="../qtcore/qchar.html#SpecialCharacter-enum">QChar::ParagraphSeparator</a>.</p><p><b>See also </b><a href="qtextdocumentfragment.html#toPlainText">QTextDocumentFragment::toPlainText</a>().</p>
<!-- @@@selection -->
<!-- $$$selectionEnd[overload1]$$$selectionEnd -->
<h3 class="fn" id="selectionEnd"><a name="selectionEnd"></a><span class="type">int</span> QTextCursor::<span class="name">selectionEnd</span>() const</h3>
<p>Returns the end of the selection or <a href="qtextcursor.html#position">position</a>() if the cursor doesn't have a selection.</p>
<p><b>See also </b><a href="qtextcursor.html#selectionStart">selectionStart</a>(), <a href="qtextcursor.html#position">position</a>(), and <a href="qtextcursor.html#anchor">anchor</a>().</p>
<!-- @@@selectionEnd -->
<!-- $$$selectionStart[overload1]$$$selectionStart -->
<h3 class="fn" id="selectionStart"><a name="selectionStart"></a><span class="type">int</span> QTextCursor::<span class="name">selectionStart</span>() const</h3>
<p>Returns the start of the selection or <a href="qtextcursor.html#position">position</a>() if the cursor doesn't have a selection.</p>
<p><b>See also </b><a href="qtextcursor.html#selectionEnd">selectionEnd</a>(), <a href="qtextcursor.html#position">position</a>(), and <a href="qtextcursor.html#anchor">anchor</a>().</p>
<!-- @@@selectionStart -->
<!-- $$$setBlockCharFormat[overload1]$$$setBlockCharFormatconstQTextCharFormat& -->
<h3 class="fn" id="setBlockCharFormat"><a name="setBlockCharFormat"></a><span class="type">void</span> QTextCursor::<span class="name">setBlockCharFormat</span>(const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>format</i>)</h3>
<p>Sets the block char format of the current block (or all blocks that are contained in the selection) to <i>format</i>.</p>
<p><b>See also </b><a href="qtextcursor.html#blockCharFormat">blockCharFormat</a>().</p>
<!-- @@@setBlockCharFormat -->
<!-- $$$setBlockFormat[overload1]$$$setBlockFormatconstQTextBlockFormat& -->
<h3 class="fn" id="setBlockFormat"><a name="setBlockFormat"></a><span class="type">void</span> QTextCursor::<span class="name">setBlockFormat</span>(const <span class="type"><a href="qtextblockformat.html">QTextBlockFormat</a></span> &amp;<i>format</i>)</h3>
<p>Sets the block format of the current block (or all blocks that are contained in the selection) to <i>format</i>.</p>
<p><b>See also </b><a href="qtextcursor.html#blockFormat">blockFormat</a>() and <a href="qtextcursor.html#mergeBlockFormat">mergeBlockFormat</a>().</p>
<!-- @@@setBlockFormat -->
<!-- $$$setCharFormat[overload1]$$$setCharFormatconstQTextCharFormat& -->
<h3 class="fn" id="setCharFormat"><a name="setCharFormat"></a><span class="type">void</span> QTextCursor::<span class="name">setCharFormat</span>(const <span class="type"><a href="qtextcharformat.html">QTextCharFormat</a></span> &amp;<i>format</i>)</h3>
<p>Sets the cursor's current character format to the given <i>format</i>. If the cursor has a selection, the given <i>format</i> is applied to the current selection.</p>
<p><b>See also </b><a href="qtextcursor.html#charFormat">charFormat</a>(), <a href="qtextcursor.html#hasSelection">hasSelection</a>(), and <a href="qtextcursor.html#mergeCharFormat">mergeCharFormat</a>().</p>
<!-- @@@setCharFormat -->
<!-- $$$setKeepPositionOnInsert[overload1]$$$setKeepPositionOnInsertbool -->
<h3 class="fn" id="setKeepPositionOnInsert"><a name="setKeepPositionOnInsert"></a><span class="type">void</span> QTextCursor::<span class="name">setKeepPositionOnInsert</span>(<span class="type">bool</span> <i>b</i>)</h3>
<p>Defines whether the cursor should keep its current position when text gets inserted at the current position of the cursor.</p>
<p>If <i>b</i> is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. If <i>b</i> is false, the cursor moves along with the inserted text.</p>
<p>The default is false.</p>
<p>Note that a cursor always moves when text is inserted before the current position of the cursor, and it always keeps its position when text is inserted after the current position of the cursor.</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextcursor.html#keepPositionOnInsert">keepPositionOnInsert</a>().</p>
<!-- @@@setKeepPositionOnInsert -->
<!-- $$$setPosition[overload1]$$$setPositionintMoveMode -->
<h3 class="fn" id="setPosition"><a name="setPosition"></a><span class="type">void</span> QTextCursor::<span class="name">setPosition</span>(<span class="type">int</span> <i>pos</i>, <span class="type"><a href="qtextcursor.html#MoveMode-enum">MoveMode</a></span> <i>m</i> = MoveAnchor)</h3>
<p>Moves the cursor to the absolute position in the document specified by <i>pos</i> using a <code>MoveMode</code> specified by <i>m</i>. The cursor is positioned between characters.</p>
<p><b>See also </b><a href="qtextcursor.html#position">position</a>(), <a href="qtextcursor.html#movePosition">movePosition</a>(), and <a href="qtextcursor.html#anchor">anchor</a>().</p>
<!-- @@@setPosition -->
<!-- $$$setVerticalMovementX[overload1]$$$setVerticalMovementXint -->
<h3 class="fn" id="setVerticalMovementX"><a name="setVerticalMovementX"></a><span class="type">void</span> QTextCursor::<span class="name">setVerticalMovementX</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Sets the visual x position for vertical cursor movements to <i>x</i>.</p>
<p>The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a visually straight line with proportional fonts, and to gently &quot;jump&quot; over short lines.</p>
<p>A value of -1 indicates no predefined x position. It will then be set automatically the next time the cursor moves up or down.</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextcursor.html#verticalMovementX">verticalMovementX</a>().</p>
<!-- @@@setVerticalMovementX -->
<!-- $$$setVisualNavigation[overload1]$$$setVisualNavigationbool -->
<h3 class="fn" id="setVisualNavigation"><a name="setVisualNavigation"></a><span class="type">void</span> QTextCursor::<span class="name">setVisualNavigation</span>(<span class="type">bool</span> <i>b</i>)</h3>
<p>Sets visual navigation to <i>b</i>.</p>
<p>Visual navigation means skipping over hidden text paragraphs. The default is false.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qtextcursor.html#visualNavigation">visualNavigation</a>() and <a href="qtextcursor.html#movePosition">movePosition</a>().</p>
<!-- @@@setVisualNavigation -->
<!-- $$$swap[overload1]$$$swapQTextCursor& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QTextCursor::<span class="name">swap</span>(<span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>)</h3>
<p>Swaps this text cursor instance with <i>other</i>. This function is very fast and never fails.</p>
<p>This function was introduced in  Qt 5.0.</p>
<!-- @@@swap -->
<!-- $$$verticalMovementX[overload1]$$$verticalMovementX -->
<h3 class="fn" id="verticalMovementX"><a name="verticalMovementX"></a><span class="type">int</span> QTextCursor::<span class="name">verticalMovementX</span>() const</h3>
<p>Returns the visual x position for vertical cursor movements.</p>
<p>A value of -1 indicates no predefined x position. It will then be set automatically the next time the cursor moves up or down.</p>
<p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qtextcursor.html#setVerticalMovementX">setVerticalMovementX</a>().</p>
<!-- @@@verticalMovementX -->
<!-- $$$visualNavigation[overload1]$$$visualNavigation -->
<h3 class="fn" id="visualNavigation"><a name="visualNavigation"></a><span class="type">bool</span> QTextCursor::<span class="name">visualNavigation</span>() const</h3>
<p>Returns <code>true</code> if the cursor does visual navigation; otherwise returns <code>false</code>.</p>
<p>Visual navigation means skipping over hidden text paragraphs. The default is false.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qtextcursor.html#setVisualNavigation">setVisualNavigation</a>() and <a href="qtextcursor.html#movePosition">movePosition</a>().</p>
<!-- @@@visualNavigation -->
<!-- $$$operator!=[overload1]$$$operator!=constQTextCursor& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QTextCursor::<span class="name">operator!=</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is at a different position in the document as this cursor; otherwise returns <code>false</code>.</p>
<!-- @@@operator!= -->
<!-- $$$operator<[overload1]$$$operator<constQTextCursor& -->
<h3 class="fn" id="operator-lt"><a name="operator-lt"></a><span class="type">bool</span> QTextCursor::<span class="name">operator&lt;</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is positioned later in the document than this cursor; otherwise returns <code>false</code>.</p>
<!-- @@@operator< -->
<!-- $$$operator<=[overload1]$$$operator<=constQTextCursor& -->
<h3 class="fn" id="operator-lt-eq"><a name="operator-lt-eq"></a><span class="type">bool</span> QTextCursor::<span class="name">operator&lt;=</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is positioned later or at the same position in the document as this cursor; otherwise returns false.</p>
<!-- @@@operator<= -->
<!-- $$$operator=[overload1]$$$operator=QTextCursor&& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;QTextCursor::<span class="name">operator=</span>(<span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;&amp;<i>other</i>)</h3>
<p>Move-assignment operator.</p><!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQTextCursor& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;QTextCursor::<span class="name">operator=</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>cursor</i>)</h3>
<p>Makes a copy of <i>cursor</i> and assigns it to this <a href="qtextcursor.html">QTextCursor</a>. Note that <a href="qtextcursor.html">QTextCursor</a> is an <a href="../qtcore/implicit-sharing.html#implicitly-shared-classes">implicitly shared</a> class.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQTextCursor& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QTextCursor::<span class="name">operator==</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is at the same position in the document as this cursor; otherwise returns <code>false</code>.</p>
<!-- @@@operator== -->
<!-- $$$operator>[overload1]$$$operator>constQTextCursor& -->
<h3 class="fn" id="operator-gt"><a name="operator-gt"></a><span class="type">bool</span> QTextCursor::<span class="name">operator&gt;</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is positioned earlier in the document than this cursor; otherwise returns <code>false</code>.</p>
<!-- @@@operator> -->
<!-- $$$operator>=[overload1]$$$operator>=constQTextCursor& -->
<h3 class="fn" id="operator-gt-eq"><a name="operator-gt-eq"></a><span class="type">bool</span> QTextCursor::<span class="name">operator&gt;=</span>(const <span class="type"><a href="qtextcursor.html#QTextCursor">QTextCursor</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if the <i>other</i> cursor is positioned earlier or at the same position in the document as this cursor; otherwise returns false.</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>