summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2011-11-15 13:17:19 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-21 22:45:25 +0100
commit9eba201a48874c93f398c7c1c053b5ddbeda7712 (patch)
tree95ba6f9a3f4c0eddb5fd0c5e0392193b77262f75 /src/gui/text
parent47304c2c04e785d86cb0d366efbcc5b78d8acf55 (diff)
Fix QLineControl work properly with input method selection event
Same as what 1189ebff320b8dd03637947c92df6e3ef84a3c06 did for QWidgetLineControl. Change-Id: I0991c2a2af126cfd7203829adc33bb4e6d45a7f2 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qlinecontrol.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/text/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp
index 438300d3bc..7b7b2ac132 100644
--- a/src/gui/text/qlinecontrol.cpp
+++ b/src/gui/text/qlinecontrol.cpp
@@ -249,13 +249,13 @@ void QLineControl::setSelection(int start, int length)
}
if (length > 0) {
- if (start == m_selstart && start + length == m_selend)
+ if (start == m_selstart && start + length == m_selend && m_cursor == m_selend)
return;
m_selstart = start;
m_selend = qMin(start + length, (int)m_text.length());
m_cursor = m_selend;
} else if (length < 0){
- if (start == m_selend && start + length == m_selstart)
+ if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart)
return;
m_selstart = qMax(start + length, 0);
m_selend = start;
@@ -419,6 +419,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
|| event->preeditString() != preeditAreaText()
|| event->replacementLength() > 0;
bool cursorPositionChanged = false;
+ bool selectionChange = false;
if (isGettingInput) {
// If any text is being input, remove selected text.
@@ -462,6 +463,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
if (m_selend < m_selstart) {
qSwap(m_selstart, m_selend);
}
+ selectionChange = true;
} else {
m_selstart = m_selend = 0;
}
@@ -499,6 +501,9 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
emit updateMicroFocus();
if (isGettingInput)
finishChange(priorState);
+
+ if (selectionChange)
+ emit selectionChanged();
}
/*!
@@ -586,7 +591,7 @@ void QLineControl::selectWordAtPos(int cursor)
bool QLineControl::finishChange(int validateFromState, bool update, bool edited)
{
Q_UNUSED(update)
- bool lineDirty = m_selDirty;
+
if (m_textDirty) {
// do validation
bool wasValidInput = m_validInput;
@@ -617,7 +622,7 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited)
m_textDirty = false;
}
updateDisplayText();
- lineDirty |= m_textDirty;
+
if (m_textDirty) {
m_textDirty = false;
QString actualText = text();