aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaishree Vyas <Jaishree.Vyas@qt.io>2022-03-28 15:24:55 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-29 17:15:34 +0000
commit7b73e64ff61409733a406e3ad4e7b83378d6b827 (patch)
tree672b92bbd1b647cd8de3c9b88e6a400813a782ea
parente4a00ddb14558e6bc528aba3db89c70bbb0ac583 (diff)
Doc: Improve cursorPosition description in TextInput and TextEdit docs
Fixes: QTBUG-97169 Change-Id: I060be767dd980c489d8e5426d67f2e8b6d21e96c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ivan Tkachenko <me@ratijas.tk> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 79807f37b5e9e9744fdaf7af380fd7bfb7ed85f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/items/qquicktextedit.cpp10
-rw-r--r--src/quick/items/qquicktextinput.cpp15
2 files changed, 23 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 32a27661ea..ebc13aa50f 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1203,7 +1203,15 @@ void QQuickTextEdit::setCursorVisible(bool on)
/*!
\qmlproperty int QtQuick::TextEdit::cursorPosition
- The position of the cursor in the TextEdit.
+ The position of the cursor in the TextEdit. The cursor is positioned between
+ characters.
+
+ \note The \e characters in this case refer to the string of \l QChar objects,
+ therefore 16-bit Unicode characters, and the position is considered an index
+ into this string. This does not necessarily correspond to individual graphemes
+ in the writing system, as a single grapheme may be represented by multiple
+ Unicode characters, such as in the case of surrogate pairs, linguistic
+ ligatures or diacritics.
*/
int QQuickTextEdit::cursorPosition() const
{
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 42720c6753..4e2f286974 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -830,7 +830,20 @@ void QQuickTextInput::setCursorVisible(bool on)
/*!
\qmlproperty int QtQuick::TextInput::cursorPosition
- The position of the cursor in the TextInput.
+ The position of the cursor in the TextInput. The cursor is positioned between
+ characters.
+
+ \note The \e characters in this case refer to the string of \l QChar objects,
+ therefore 16-bit Unicode characters, and the position is considered an index
+ into this string. This does not necessarily correspond to individual graphemes
+ in the writing system, as a single grapheme may be represented by multiple
+ Unicode characters, such as in the case of surrogate pairs, linguistic
+ ligatures or diacritics.
+
+ \l displayText is different if echoMode is set to \l TextInput.Password: then
+ each passwordMaskCharacter is a "narrow" character
+ (the cursorPosition always moves by 1), even if the text in the TextInput is not.
+
*/
int QQuickTextInput::cursorPosition() const
{