summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-09-22 08:23:23 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-09-22 08:23:23 (GMT)
commitc3669d24b498aa0661ade5ed7465260788f629b5 (patch)
treee952f028dc780dcf3e6edf5ccf7f081c3b67e93b /src
parentada33b11092f278ae4f1280a6da07ffd151a31b6 (diff)
downloadQt-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.cpp4
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)