diff options
author | axis <qt-info@nokia.com> | 2010-09-01 11:53:32 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-09-01 13:09:46 (GMT) |
commit | 5ca6264933af60b3cd376b7f08bea008fa69b515 (patch) | |
tree | 19849b13b22d53b50973c983c4df385cfe253ada | |
parent | f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f (diff) | |
download | Qt-5ca6264933af60b3cd376b7f08bea008fa69b515.zip Qt-5ca6264933af60b3cd376b7f08bea008fa69b515.tar.gz Qt-5ca6264933af60b3cd376b7f08bea008fa69b515.tar.bz2 |
Fixed input context trying to squeeze content into a full widget.
Problem was reproduced on N97. If the FEP detects that the widget is
full while still editing text, it will try to send those events as
key events instead. Since this screws up the content in the widget,
we stop those events from reaching the widget in the input context.
AutoTest: Passed
Task: QTBUG-12949
RevBy: Miikka Heikkinen
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qinputcontext/tst_qinputcontext.cpp | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 135b894..add3d17 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -236,6 +236,13 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) break; } + QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString(); + int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(); + if (!keyEvent->text().isEmpty() && widgetText.size() + m_preeditString.size() >= maxLength) { + // Don't send key events with string content if the widget is "full". + return true; + } + if (keyEvent->type() == QEvent::KeyPress && focusWidget()->inputMethodHints() & Qt::ImhHiddenText && !keyEvent->text().isEmpty()) { diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index c90cc5b..93813f9 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -932,9 +932,6 @@ void tst_QInputContext::symbianTestCoeFepInputContext() QApplication::processEvents(); QCOMPARE(lineedit->text(), finalString); - QEXPECT_FAIL("Numbers with movement, maxlength, password and unfinished text" - , "Fails due to QTBUG-12949" - , Continue); QCOMPARE(ic->m_preeditString, preeditString); #endif } |