From 7851568c65e0560056c6fa541039543d43a63e20 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Tue, 4 Oct 2011 17:44:35 +0300 Subject: QLineEdit - made mouse interactions commit preedit Simplifying input context mouse handling rules by making the editor in charge when text gets committed and selected. This includes: - Allowing selection to start on top of preedit. Commits once a single character gets selected - Double click to commit preedit before selecting a word. - Only sending events to input context that happen on top of preedit. - Committing preedit when a mouse press happens outside of it, allowing to move cursor to click position. Change-Id: I9dab00ea3445055ffd0d7cae540a1197c5748509 Reviewed-by: Lars Knoll --- src/widgets/widgets/qlineedit_p.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/widgets/widgets/qlineedit_p.cpp') diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 247d0afb0b..b17651e1d3 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -259,19 +259,15 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e ) if ( control->composeMode() ) { int tmp_cursor = xToPos(e->pos().x()); int mousePos = tmp_cursor - control->cursor(); - if ( mousePos < 0 || mousePos > control->preeditAreaText().length() ) { + if ( mousePos < 0 || mousePos > control->preeditAreaText().length() ) mousePos = -1; - // don't send move events outside the preedit area - if ( e->type() == QEvent::MouseMove ) - return true; - } QInputContext *qic = q->inputContext(); - if ( qic ) + if (qic && mousePos >= 0) { // may be causing reset() in some input methods qic->mouseHandler(mousePos, e); - if (!control->preeditAreaText().isEmpty()) return true; + } } #else Q_UNUSED(e); -- cgit v1.2.3