Adapt from input context mousehandler to input panel in QLineEdit
Change-Id: If14d0cc18188da1dbc8b152fa2fa9583ff03b3bc Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
This commit is contained in:
parent
a1743e4681
commit
b652cc8d20
@ -51,7 +51,7 @@
|
|||||||
#include "qaccessible.h"
|
#include "qaccessible.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef QT_NO_IM
|
#ifndef QT_NO_IM
|
||||||
#include "qinputcontext.h"
|
#include "qinputpanel.h"
|
||||||
#include "qlist.h"
|
#include "qlist.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -249,23 +249,22 @@ void QLineEditPrivate::resetInputPanel()
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
This function is not intended as polymorphic usage. Just a shared code
|
This function is not intended as polymorphic usage. Just a shared code
|
||||||
fragment that calls QInputContext::mouseHandler for this
|
fragment that calls QInputPanel::invokeAction for this
|
||||||
class.
|
class.
|
||||||
*/
|
*/
|
||||||
bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
|
bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
|
||||||
{
|
{
|
||||||
#if !defined QT_NO_IM
|
#if !defined QT_NO_IM
|
||||||
Q_Q(QLineEdit);
|
|
||||||
if ( control->composeMode() ) {
|
if ( control->composeMode() ) {
|
||||||
int tmp_cursor = xToPos(e->pos().x());
|
int tmp_cursor = xToPos(e->pos().x());
|
||||||
int mousePos = tmp_cursor - control->cursor();
|
int mousePos = tmp_cursor - control->cursor();
|
||||||
if ( mousePos < 0 || mousePos > control->preeditAreaText().length() )
|
if ( mousePos < 0 || mousePos > control->preeditAreaText().length() )
|
||||||
mousePos = -1;
|
mousePos = -1;
|
||||||
|
|
||||||
QInputContext *qic = q->inputContext();
|
if (mousePos >= 0) {
|
||||||
if (qic && mousePos >= 0) {
|
if (e->type() == QEvent::MouseButtonRelease)
|
||||||
// may be causing reset() in some input methods
|
qApp->inputPanel()->invokeAction(QInputPanel::Click, mousePos);
|
||||||
qic->mouseHandler(mousePos, e);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user