From 6545932efa45ea2b8fbc1459d760ec5f15c63120 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 29 May 2009 14:42:35 +0200 Subject: Revert "Changed the behavior of ImCursorPosition slightly." This reverts commit ce02d0e9e0ad8d8ac47e4f3ee95bac5cb74ed184. This turned out not to be enough for proper selection support together with S60 FEP. Instead we will revert the behavior and add new API. --- doc/src/qnamespace.qdoc | 2 -- src/gui/text/qtextcontrol.cpp | 2 +- src/gui/widgets/qlineedit.cpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index fc0598f..a7663f8 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -2429,8 +2429,6 @@ \value ImMicroFocus The rectangle covering the area of the input cursor in widget coordinates. \value ImFont The currently used font for text input. \value ImCursorPosition The logical position of the cursor within the text surrounding the input area (see ImSurroundingText). - If any text is selected, the position returned will be at the logical end of the - selection, even if the real cursor is located at the logical start. \value ImSurroundingText The plain text around the input area, for example the current paragraph. \value ImCurrentSelection The currently selected text. \value ImMaximumTextLength The maximum number of characters that the widget can hold. If there is no limit, QVariant() is returned. diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index c74af23..f6092bb 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1865,7 +1865,7 @@ QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImFont: return QVariant(d->cursor.charFormat().font()); case Qt::ImCursorPosition: - return QVariant(d->cursor.selectionEnd() - block.position()); + return QVariant(d->cursor.position() - block.position()); case Qt::ImSurroundingText: return QVariant(block.text()); case Qt::ImCurrentSelection: diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 0d8e16f..61b8786 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2337,7 +2337,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const case Qt::ImFont: return font(); case Qt::ImCursorPosition: - return QVariant((d->selend - d->selstart == 0) ? d->cursor : d->selend); + return QVariant(d->cursor); case Qt::ImSurroundingText: return QVariant(d->text); case Qt::ImCurrentSelection: -- cgit v0.12