src/gui/text/qtextcursor.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   860     \brief The QTextCursor class offers an API to access and modify QTextDocuments.
   860     \brief The QTextCursor class offers an API to access and modify QTextDocuments.
   861 
   861 
   862     \ingroup richtext-processing
   862     \ingroup richtext-processing
   863     \ingroup shared
   863     \ingroup shared
   864 
   864 
   865 
   865     Text cursors are objects that are used to access and modify the
   866     Text cursors are objects that are used to access and modify the contents
   866     contents and underlying structure of text documents via a
   867     and underlying structure of text documents via a programming interface
   867     programming interface that mimics the behavior of a cursor in a
   868     that mimics the behavior of a cursor in a text editor. QTextCursor contains
   868     text editor. QTextCursor contains information about both the
   869     information about both the cursor's position within a QTextDocument and any
   869     cursor's position within a QTextDocument and any selection that it
   870     selection that it has made.
   870     has made.
   871 
   871 
   872     QTextCursor is modeled on the way a text cursor behaves in a text
   872     QTextCursor is modeled on the way a text cursor behaves in a text
   873     editor, providing a programmatic means of performing standard actions
   873     editor, providing a programmatic means of performing standard
   874     through the user interface. A document can be thought of as a
   874     actions through the user interface. A document can be thought of
   875     single string of characters with the cursor's position() being \e
   875     as a single string of characters. The cursor's current position()
   876     between any two characters (or at the very beginning or very end
   876     then is always either \e between two consecutive characters in the
   877     of the document). Documents can also contain tables, lists,
   877     string, or else \e before the very first character or \e after the
   878     images, and other objects in addition to text but, from the developer's
   878     very last character in the string.  Documents can also contain
   879     point of view, the document can be treated as one long string.
   879     tables, lists, images, and other objects in addition to text but,
   880     Some portions of that string can be considered to lie within particular
   880     from the developer's point of view, the document can be treated as
   881     blocks (e.g. paragraphs), or within a table's cell, or a list's item,
   881     one long string.  Some portions of that string can be considered
   882     or other structural elements. When we refer to "current character" we
   882     to lie within particular blocks (e.g. paragraphs), or within a
   883     mean the character immediately after the cursor position() in the
   883     table's cell, or a list's item, or other structural elements. When
   884     document; similarly the "current block" is the block that contains the
   884     we refer to "current character" we mean the character immediately
   885     cursor position().
   885     \e before the cursor position() in the document. Similarly, the
       
   886     "current block" is the block that contains the cursor position().
   886 
   887 
   887     A QTextCursor also has an anchor() position. The text that is
   888     A QTextCursor also has an anchor() position. The text that is
   888     between the anchor() and the position() is the selection. If
   889     between the anchor() and the position() is the selection. If
   889     anchor() == position() there is no selection.
   890     anchor() == position() there is no selection.
   890 
   891 
   938 
   939 
   939     Actions can be grouped (i.e. treated as a single action for
   940     Actions can be grouped (i.e. treated as a single action for
   940     undo/redo) using beginEditBlock() and endEditBlock().
   941     undo/redo) using beginEditBlock() and endEditBlock().
   941 
   942 
   942     Cursor movements are limited to valid cursor positions. In Latin
   943     Cursor movements are limited to valid cursor positions. In Latin
   943     writing this is usually after every character in the text. In some
   944     writing this is between any two consecutive characters in the
   944     other writing systems cursor movements are limited to "clusters"
   945     text, before the first character, or after the last character. In
   945     (e.g. a syllable in Devanagari, or a base letter plus diacritics).
   946     some other writing systems cursor movements are limited to
   946     Functions such as movePosition() and deleteChar() limit cursor
   947     "clusters" (e.g. a syllable in Devanagari, or a base letter plus
   947     movement to these valid positions.
   948     diacritics).  Functions such as movePosition() and deleteChar()
       
   949     limit cursor movement to these valid positions.
   948 
   950 
   949     \sa \link richtext.html Rich Text Processing\endlink
   951     \sa \link richtext.html Rich Text Processing\endlink
   950 
   952 
   951 */
   953 */
   952 
   954 
  1737 
  1739 
  1738     d->setBlockCharFormat(modifier, QTextDocumentPrivate::MergeFormat);
  1740     d->setBlockCharFormat(modifier, QTextDocumentPrivate::MergeFormat);
  1739 }
  1741 }
  1740 
  1742 
  1741 /*!
  1743 /*!
  1742     Returns the format of the character immediately before the cursor position(). If the cursor is
  1744     Returns the format of the character immediately before the cursor
  1743     positioned at the beginning of a text block that is not empty then the format of the character
  1745     position(). If the cursor is positioned at the beginning of a text
       
  1746     block that is not empty then the format of the character
  1744     immediately after the cursor is returned.
  1747     immediately after the cursor is returned.
  1745 
  1748 
  1746     \sa insertText(), blockFormat()
  1749     \sa insertText(), blockFormat()
  1747  */
  1750  */
  1748 QTextCharFormat QTextCursor::charFormat() const
  1751 QTextCharFormat QTextCursor::charFormat() const