diff options
Diffstat (limited to 'src/gui/widgets')
-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; } |