summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-09-01 13:53:32 +0200
committerJason McDonald <jason.mcdonald@nokia.com>2010-09-03 13:26:24 +1000
commite7ec4e58632e4e0c22086f929846325a56717dab (patch)
tree5d34d700a1319f89528e55bfebea3e47bbad497a
parent53f23931b51ddc8c9348b3e7855fc734588a6353 (diff)
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 (cherry picked from commit 5ca6264933af60b3cd376b7f08bea008fa69b515)
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp7
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp3
2 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 3ca5bb95f1..65104ed5d4 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 23cfd9e9ba..8eef2cc794 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -933,9 +933,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
}