diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-05-12 18:09:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-16 14:40:21 +0200 |
commit | 8f6254a88e4c634203df779aa385d9955e91b56f (patch) | |
tree | 6b6a629467163b5119a8e830708a753f5e3bc469 /src/quick/items/qquicktextcontrol.cpp | |
parent | b24cc8dc5acf2ce79f942b28debc0feedb43ac19 (diff) |
TextEdit: fix cursor rectangle positioning
QQuickTextControl::cursorRectangleChanged() wasn't emitted as
appropriate when dragging mouse => The cursor delegate was stuck
in wrong position under certain circumstances, especially when
selecting multiple lines.
Task-number: QTBUG-38947
Change-Id: Ib5b0d2f6ea2a1b3712fbaba4a7ad1865d2b0a74e
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/quick/items/qquicktextcontrol.cpp')
-rw-r--r-- | src/quick/items/qquicktextcontrol.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 53d736fb36..3087835212 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -423,7 +423,6 @@ void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged / #endif emit q->selectionChanged(); } - q->updateCursorRectangle(true); } void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection() @@ -1152,8 +1151,10 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou #endif if (interactionFlags & Qt::TextEditable) { - if (cursor.position() != oldCursorPos) + if (cursor.position() != oldCursorPos) { emit q->cursorPositionChanged(); + q->updateCursorRectangle(true); + } _q_updateCurrentCharFormatAndSelection(); #ifndef QT_NO_IM if (qGuiApp) @@ -1161,6 +1162,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou #endif } else if (cursor.position() != oldCursorPos) { emit q->cursorPositionChanged(); + q->updateCursorRectangle(true); } selectionChanged(true); repaintOldAndNewSelection(oldSelection); @@ -1255,6 +1257,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin setClipboardSelection(); #endif emit q->cursorPositionChanged(); + q->updateCursorRectangle(true); } } else if (!sendMouseEventToInputContext(e, pos)) { e->ignore(); |