Fix QWidgetTextController issue when used with QtQuick1 TextEdit

Calling QInputMethod::invokeAction() was not checking for proper event
type and was requiring context widget unnecessarily.
Fixes some parts of QTBUG-24035

Change-Id: I51fe9ed02a018ced36319eb672a088503649b275
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
This commit is contained in:
Pekka Vuorela 2012-03-20 18:52:50 +02:00 committed by Qt by Nokia
parent 0f9e98a586
commit a80d2c73c1

View File

@ -1829,7 +1829,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
#if !defined(QT_NO_IM) #if !defined(QT_NO_IM)
Q_Q(QWidgetTextControl); Q_Q(QWidgetTextControl);
if (contextWidget && isPreediting()) { if (isPreediting()) {
QTextLayout *layout = cursor.block().layout(); QTextLayout *layout = cursor.block().layout();
int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position();
@ -1837,7 +1837,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
cursorPos = -1; cursorPos = -1;
if (cursorPos >= 0) { if (cursorPos >= 0) {
if (e->type() == QEvent::MouseButtonRelease) if (eventType == QEvent::MouseButtonRelease)
qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos); qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
e->setAccepted(true); e->setAccepted(true);