aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2024-02-23 12:17:37 +0100
committerEike Ziller <eike.ziller@qt.io>2024-02-27 08:00:21 +0000
commitfdabbfcbcfe35bce731a2eff3fe13e2d6df238b9 (patch)
tree63e9f50fec7365f3ba9b390f062b8ef399060f5e
parent3d8592edd1bb3f211a3f53584fb2c5d394c9941a (diff)
Diff: Fix that dialog for "Revert Chunk" closes right away
On macOS. Change-Id: Ifbe402c44779e4062a5dfb5d7c09da7ac845acce Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
-rw-r--r--src/plugins/diffeditor/diffeditorwidgetcontroller.cpp9
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp18
2 files changed, 18 insertions, 9 deletions
diff --git a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
index 0f3a57ee08..9decc5f1a6 100644
--- a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
+++ b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
@@ -267,9 +267,12 @@ void DiffEditorWidgetController::addPatchAction(QMenu *menu, int fileIndex, int
const QString actionName = patchAction == PatchAction::Apply ? Tr::tr("Apply Chunk...")
: Tr::tr("Revert Chunk...");
QAction *action = menu->addAction(actionName);
- connect(action, &QAction::triggered, this, [this, fileIndex, chunkIndex, patchAction] {
- patch(patchAction, fileIndex, chunkIndex);
- });
+ connect(
+ action,
+ &QAction::triggered,
+ this,
+ [this, fileIndex, chunkIndex, patchAction] { patch(patchAction, fileIndex, chunkIndex); },
+ Qt::QueuedConnection);
const bool enabled = chunkExists(fileIndex, chunkIndex)
&& (patchAction == PatchAction::Revert || fileNamesAreDifferent(fileIndex));
action->setEnabled(enabled);
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index b10758233a..38bb004a2d 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -995,14 +995,20 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)
// the user has "Open With" and choose the right diff editor so that
// fileNameFromDiffSpecification() works.
QAction *applyAction = menu->addAction(Tr::tr("Apply Chunk..."));
- connect(applyAction, &QAction::triggered, this, [this, chunk] {
- slotApplyDiffChunk(chunk, PatchAction::Apply);
- });
+ connect(
+ applyAction,
+ &QAction::triggered,
+ this,
+ [this, chunk] { slotApplyDiffChunk(chunk, PatchAction::Apply); },
+ Qt::QueuedConnection);
// Revert a chunk from a VCS diff, which might be linked to reloading the diff.
QAction *revertAction = menu->addAction(Tr::tr("Revert Chunk..."));
- connect(revertAction, &QAction::triggered, this, [this, chunk] {
- slotApplyDiffChunk(chunk, PatchAction::Revert);
- });
+ connect(
+ revertAction,
+ &QAction::triggered,
+ this,
+ [this, chunk] { slotApplyDiffChunk(chunk, PatchAction::Revert); },
+ Qt::QueuedConnection);
// Custom diff actions
addDiffActions(menu, chunk);
break;