summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qlineedit_p.cpp
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2011-10-04 17:44:35 +0300
committerQt by Nokia <qt-info@nokia.com>2011-11-05 23:47:02 +0100
commit7851568c65e0560056c6fa541039543d43a63e20 (patch)
tree75eef36925198b1e21d60ae1916b1cca8f634ee6 /src/widgets/widgets/qlineedit_p.cpp
parent10dc2171cf004705f8212f5100b99bfde04c8d54 (diff)
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 <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qlineedit_p.cpp')
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp10
1 files changed, 3 insertions, 7 deletions
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);