diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2011-04-28 09:11:42 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2011-04-28 09:11:42 (GMT) |
commit | e3aa9ad1a15505fb2ac8e51e4da4e219efc62e66 (patch) | |
tree | 184d13abc3c189b5d3f29b891909b426cac85132 /src/gui/widgets/qlinecontrol.cpp | |
parent | d8b933084ecc6ded6689f71ea6ca2e5fd339faf3 (diff) | |
parent | 8e615d9b07f6146b5cb6b56c4cd2e32376a8b429 (diff) | |
download | Qt-e3aa9ad1a15505fb2ac8e51e4da4e219efc62e66.zip Qt-e3aa9ad1a15505fb2ac8e51e4da4e219efc62e66.tar.gz Qt-e3aa9ad1a15505fb2ac8e51e4da4e219efc62e66.tar.bz2 |
Merge branch '4.8-upstream'
Diffstat (limited to 'src/gui/widgets/qlinecontrol.cpp')
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index fa41c29..ced66e5 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(); @@ -435,7 +443,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) removeSelectedText(); } if (!event->commitString().isEmpty()) { - insert(event->commitString()); + internalInsert(event->commitString()); cursorPositionChanged = true; } |