From 9456052207dbd1263dfc69a259d8ae3a6c9b2647 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 2 Sep 2022 13:31:09 +0200 Subject: [PATCH] Editor: do not replace selection in drop editor Only remove the selected text if the drag source is the editor and we want to move the selection. Fixes: QTCREATORBUG-28126 Change-Id: Iaa54d54c432df2da99e30ddb569e06e3ccd0df00 Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 76cf8c3232e..2b55229c6ce 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7665,7 +7665,7 @@ void TextEditorWidget::dropEvent(QDropEvent *e) MultiTextCursor cursor = multiTextCursor(); cursor.beginEditBlock(); const QTextCursor eventCursor = cursorForPosition(e->pos()); - if (e->dropAction() == Qt::MoveAction) + if (e->dropAction() == Qt::MoveAction && e->source() == viewport()) cursor.removeSelectedText(); cursor.setCursors({eventCursor}); setMultiTextCursor(cursor);