summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-04-19 05:11:36 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-04-21 05:22:57 (GMT)
commit60198a071dd76e57ab799215f0fbddc8d550ba30 (patch)
treef5801fea0958e2fb572e3a7de62ff6fe6e735c46 /src/gui
parent2f173e4945dd8414636c1061acfaf9c2d8b718d8 (diff)
downloadQt-60198a071dd76e57ab799215f0fbddc8d550ba30.zip
Qt-60198a071dd76e57ab799215f0fbddc8d550ba30.tar.gz
Qt-60198a071dd76e57ab799215f0fbddc8d550ba30.tar.bz2
Fix TextInput cursor position unchanged when selection length is 0.
Move the cursor position to the start position when both the new and old selections are empty as would happen if either was non-empty. Change-Id: I493e52c551b47e009fd13b3e95856ff012ee5d95 Task-number: QTBUG-18768 Reviewed-by: Martin Jones
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index d03e5de..202ea7a 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -254,12 +254,20 @@ void QLineControl::setSelection(int start, int length)
m_selstart = start;
m_selend = qMin(start + length, (int)m_text.length());
m_cursor = m_selend;
- } else {
+ } else if (length < 0){
if (start == m_selend && start + length == m_selstart)
return;
m_selstart = qMax(start + length, 0);
m_selend = start;
m_cursor = m_selstart;
+ } else if (m_selstart != m_selend) {
+ m_selstart = 0;
+ m_selend = 0;
+ m_cursor = start;
+ } else {
+ m_cursor = start;
+ emitCursorPositionChanged();
+ return;
}
emit selectionChanged();
emitCursorPositionChanged();