diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-09-22 08:23:23 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2011-09-22 08:23:23 (GMT) |
commit | c3669d24b498aa0661ade5ed7465260788f629b5 (patch) | |
tree | e952f028dc780dcf3e6edf5ccf7f081c3b67e93b /src | |
parent | ada33b11092f278ae4f1280a6da07ffd151a31b6 (diff) | |
download | Qt-c3669d24b498aa0661ade5ed7465260788f629b5.zip Qt-c3669d24b498aa0661ade5ed7465260788f629b5.tar.gz Qt-c3669d24b498aa0661ade5ed7465260788f629b5.tar.bz2 |
QLineControl: selectedTextChanged() signal is omitted in some cases
QLineControl does not emit selectionChanged() signal when
selection is changed due to handling of input method query.
As a fix, the signal is emitted when internal values for selection
end and beginning are changed in processInputMethodEvent().
Additionally, added deselect() test case for both QDeclarativeTextEdit
and QDeclarativeTextInput to help out autotesting of text selections.
Note that there are some differences in the QLineControl and QTextControl
implementations. This causes the different signal counts even if the
test steps are similar.
Task-number: QTBUG-21429
Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 198bc04..c5232ad 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -447,6 +447,8 @@ void QLineControl::moveCursor(int pos, bool mark) void QLineControl::processInputMethodEvent(QInputMethodEvent *event) { int priorState = 0; + int originalSelectionStart = m_selstart; + int originalSelectionEnd = m_selend; bool isGettingInput = !event->commitString().isEmpty() || event->preeditString() != preeditAreaText() || event->replacementLength() > 0; @@ -525,6 +527,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) } m_textLayout.setAdditionalFormats(formats); updateDisplayText(/*force*/ true); + if (originalSelectionStart != m_selstart || originalSelectionEnd != m_selend) + emit selectionChanged(); if (cursorPositionChanged) emitCursorPositionChanged(); else if (m_preeditCursor != oldPreeditCursor) |