summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-09-01 11:53:32 (GMT)
committeraxis <qt-info@nokia.com>2010-09-06 08:30:13 (GMT)
commitb754ce6cef8931806175e9e7725087b46c04758f (patch)
treebbf90fe7092f510db4e0e8dc1a2a4ca532c01300
parenta2e2d2207d3b7f164ba9c9c7fa776e10bb7bc168 (diff)
downloadQt-b754ce6cef8931806175e9e7725087b46c04758f.zip
Qt-b754ce6cef8931806175e9e7725087b46c04758f.tar.gz
Qt-b754ce6cef8931806175e9e7725087b46c04758f.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 (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 278f6d4..ce0c9ff 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -233,6 +233,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 23cfd9e..8eef2cc 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
}