Support visual cursor movement for BIDI text
authorJiang Jiang <jiang.jiang@nokia.com>
Wed, 15 Dec 2010 14:11:45 +0000 (15:11 +0100)
committerJiang Jiang <jiang.jiang@nokia.com>
Fri, 29 Apr 2011 09:02:23 +0000 (11:02 +0200)
commit0f7cba14f612885151a95c590b23c5fe25efdd05
tree5dd6063357b8f554cc729d4bffe9ced2c7b988f9
parent028aa80d700ad8d6799202f1fa1beb919e6ee531
Support visual cursor movement for BIDI text

Bidi input can in some contexts be more intuitive if the cursor
works in visual way: pressing left arrow key always make cursor
move one character to the left regardless the language of text,
pressing right arrow key always make cursor move to the right.
It is also the behavior of Mac OS X. Based on the above reason
and requests from Symbian we implemented this support for visual
movement in BIDI text. 3 public properties are added to
QTextDocument, QTextLayout and QLineEdit respectively:

- QTextDocument::defaultCursorMoveStyle can be used to control
  the cursor behavior in all widgets based on QTextDocument,
  like QTextEdit, QPlainTextEdit, etc. When set to QTextCursor::
  Visual, it will enable visual movement for all the cursors in
  the corresponding text edit. Default is QTextCursor::Logical.

- QTextLayout::cursorMoveStyle is used for low-level cursor
  manipulation. When set to Visual, it will enable visual movement
  behavior for all the cursor related methods, including cursorToX,
  xToCursor and drawCursor. Default is Logical.

- QLineEdit::cursorMoveStyle is used to control cursor movement
  behavior in QLineEdit. Default is Logical.:

Task-number: QTBUG-13859
Reviewed-by: Eskil
(cherry picked from commit c480dd641f5d22d1ee72cb27bf39e24c6df65658)
17 files changed:
src/gui/text/qtextcursor.cpp
src/gui/text/qtextcursor.h
src/gui/text/qtextdocument.cpp
src/gui/text/qtextdocument.h
src/gui/text/qtextdocument_p.cpp
src/gui/text/qtextdocument_p.h
src/gui/text/qtextengine.cpp
src/gui/text/qtextengine_p.h
src/gui/text/qtextlayout.cpp
src/gui/text/qtextlayout.h
src/gui/widgets/qlinecontrol.cpp
src/gui/widgets/qlinecontrol_p.h
src/gui/widgets/qlineedit.cpp
src/gui/widgets/qlineedit.h
tests/auto/qcomplextext/tst_qcomplextext.cpp
tests/auto/qlineedit/tst_qlineedit.cpp
tests/auto/qtextedit/tst_qtextedit.cpp