diff options
author | axis <qt-info@nokia.com> | 2009-10-30 12:34:46 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-10-30 12:34:46 (GMT) |
commit | 7a2fbdaaf06e69b1b35c7e5560127ff5cd93f362 (patch) | |
tree | f158cbf2c32d046e31473b2d70e462c07c43d122 /src/gui/inputmethod | |
parent | 5e95f9c3c224b87840e750d4280806a40ed40c92 (diff) | |
parent | da9880eaed0d09338717db1a73db01e6b0ab080d (diff) | |
download | Qt-7a2fbdaaf06e69b1b35c7e5560127ff5cd93f362.zip Qt-7a2fbdaaf06e69b1b35c7e5560127ff5cd93f362.tar.gz Qt-7a2fbdaaf06e69b1b35c7e5560127ff5cd93f362.tar.bz2 |
Merge branch '4.6-s60' into 4.6
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index c4d17ff..3f21bc3 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -561,8 +561,28 @@ void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSele int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); - aCursorSelection.iAnchorPos = anchor; - aCursorSelection.iCursorPos = cursor; + QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>(); + int combinedSize = text.size() + m_preeditString.size(); + if (combinedSize < anchor || combinedSize < cursor) { + // ### TODO! FIXME! QTBUG-5050 + // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. + // The root problem is that cursor position is relative to displayed text instead of the + // actual text we get. + // + // To properly fix this we would need to know the displayText of QLineEdits instead + // of just the text, which on itself should be a trivial change. The difficulties start + // when we need to commit the changes back to the QLineEdit, which would have to be somehow + // able to handle displayText, too. + // + // Until properly fixed, the cursor and anchor positions will not reflect correct positions + // for masked QLineEdits, unless all the masked positions are filled in order so that + // cursor position relative to the displayed text matches position relative to actual text. + aCursorSelection.iAnchorPos = combinedSize; + aCursorSelection.iCursorPos = combinedSize; + } else { + aCursorSelection.iAnchorPos = anchor; + aCursorSelection.iCursorPos = cursor; + } } void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, |