diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2011-12-15 15:11:55 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 12:57:38 +0100 |
commit | 34cb6901638eb65e4db742ea70bbc0fe3e55e366 (patch) | |
tree | 0a002efc43b73586474a0de82ea4d1785606aeee | |
parent | a730a2b1962325d4e3bbd5f79d8f51af6ee04301 (diff) |
Adapt from QInputContext interface to QInputPanel
Change-Id: I4143c3b516e7b0e46c706b8a6560bca9d8951572
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 2a6831eb93..e2be1cb2bf 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -76,6 +76,7 @@ #include <qurl.h> #include <qdesktopservices.h> #include <qinputcontext.h> +#include <qinputpanel.h> #include <qtooltip.h> #include <qstyleoption.h> #include <QtWidgets/qlineedit.h> @@ -1688,11 +1689,8 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button emit q->cursorPositionChanged(); _q_updateCurrentCharFormatAndSelection(); #ifndef QT_NO_IM - if (contextWidget) { - if (QInputContext *ic = qApp->inputContext()) { - ic->update(); - } - } + if (contextWidget) + qApp->inputPanel()->update(Qt::ImQueryInput); #endif //QT_NO_IM } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); @@ -1821,34 +1819,32 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext( QEvent *e, QEvent::Type eventType, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos) { + Q_UNUSED(eventType); + Q_UNUSED(button); + Q_UNUSED(pos); + Q_UNUSED(modifiers); + Q_UNUSED(buttons); + Q_UNUSED(globalPos); #if !defined(QT_NO_IM) Q_Q(QWidgetTextControl); if (contextWidget && isPreediting()) { QTextLayout *layout = cursor.block().layout(); - QInputContext *ctx = qApp->inputContext(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); if (cursorPos < 0 || cursorPos > layout->preeditAreaText().length()) cursorPos = -1; - if (ctx && cursorPos >= 0) { - QMouseEvent ev(eventType, contextWidget->mapFromGlobal(globalPos), - contextWidget->topLevelWidget()->mapFromGlobal(globalPos), globalPos, - button, buttons, modifiers); - ctx->mouseHandler(cursorPos, &ev); - e->setAccepted(ev.isAccepted()); + if (cursorPos >= 0) { + if (e->type() == QEvent::MouseButtonRelease) + qApp->inputPanel()->invokeAction(QInputPanel::Click, cursorPos); + + e->setAccepted(true); return true; } } #else Q_UNUSED(e); - Q_UNUSED(eventType); - Q_UNUSED(button); - Q_UNUSED(pos); - Q_UNUSED(modifiers); - Q_UNUSED(buttons); - Q_UNUSED(globalPos); #endif return false; } |