aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2021-11-01 11:02:58 +0100
committerDavid Schulz <david.schulz@qt.io>2021-11-04 09:10:05 +0000
commit416cd69a5e7ab9e900320181a637ce30a40b9c4d (patch)
tree1314aeacb58e223e9f74b565059c728c12148872 /src/plugins/texteditor
parent1c526c827dca019fae833f50c74af53e747fdf9f (diff)
Editor: unselect text on mouse release event
Update the main cursor after calling QPlainTextEdit::mouseReleaseEvent. Calling that function might change the selection without changing the position, so it wont emit cursor position changed, and the multi cursor does not get updated properly. Task-number: QTCREATORBUG-26493 Change-Id: Ie310ee9a4c66897766af87065ee42fcd01302854 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/texteditor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index a54732ec39f..59ac0bba32c 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -5245,6 +5245,14 @@ void TextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
return;
QPlainTextEdit::mouseReleaseEvent(e);
+
+ d->setClipboardSelection();
+ const QTextCursor plainTextEditCursor = textCursor();
+ const QTextCursor multiMainCursor = multiTextCursor().mainCursor();
+ if (multiMainCursor.position() != plainTextEditCursor.position()
+ || multiMainCursor.anchor() != plainTextEditCursor.anchor()) {
+ doSetTextCursor(plainTextEditCursor, true);
+ }
}
void TextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)